Add custom dispatcher to Set/Map/WeakSet/WeakMap (#3790)

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
This commit is contained in:
Daniella Barsony
2020-06-17 16:07:02 +02:00
committed by GitHub
parent c55a0baaf8
commit 5d6467930a
10 changed files with 240 additions and 537 deletions
@@ -20,6 +20,10 @@
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
/**
* This object has a custom dispatch function.
*/
#define BUILTIN_CUSTOM_DISPATCH
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-map-prototype.inc.h"
#define BUILTIN_UNDERSCORED_ID map_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
@@ -35,179 +39,25 @@
*/
/**
* The Map.prototype object's 'clear' routine
*
* See also:
* ECMA-262 v6, 23.1.3.1
* Dispatcher of the built-in's routines
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_map_prototype_object_clear (ecma_value_t this_arg) /**< this argument */
ecma_value_t
ecma_builtin_map_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
ecma_length_t arguments_number) /**< length of arguments' list */
{
return ecma_op_container_clear (this_arg, LIT_MAGIC_STRING_MAP_UL);
} /* ecma_builtin_map_prototype_object_clear */
/**
* The Map.prototype object's 'delete' routine
*
* See also:
* ECMA-262 v6, 23.1.3.3
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_map_prototype_object_delete (ecma_value_t this_arg, /**< this argument */
ecma_value_t key_arg) /**< key argument */
{
return ecma_op_container_delete (this_arg, key_arg, LIT_MAGIC_STRING_MAP_UL);
} /* ecma_builtin_map_prototype_object_delete */
/**
* The Map.prototype object's 'forEach' routine
*
* See also:
* ECMA-262 v6, 23.1.3.5
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_map_prototype_object_foreach (ecma_value_t this_arg, /**< this argument */
ecma_value_t predicate, /**< callback function */
ecma_value_t predicate_this_arg) /**< this argument for
* invoke predicate */
{
return ecma_op_container_foreach (this_arg, predicate, predicate_this_arg, LIT_MAGIC_STRING_MAP_UL);
} /* ecma_builtin_map_prototype_object_foreach */
/**
* The Map.prototype object's 'get' routine
*
* See also:
* ECMA-262 v6, 23.1.3.6
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_map_prototype_object_get (ecma_value_t this_arg, /**< this argument */
ecma_value_t key_arg) /**< key argument */
{
return ecma_op_container_get (this_arg, key_arg, LIT_MAGIC_STRING_MAP_UL);
} /* ecma_builtin_map_prototype_object_get */
/**
* The Map.prototype object's 'has' routine
*
* See also:
* ECMA-262 v6, 23.1.3.7
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_map_prototype_object_has (ecma_value_t this_arg, /**< this argument */
ecma_value_t key_arg) /**< key argument */
{
return ecma_op_container_has (this_arg, key_arg, LIT_MAGIC_STRING_MAP_UL);
} /* ecma_builtin_map_prototype_object_has */
/**
* The Map.prototype object's 'set' routine
*
* See also:
* ECMA-262 v6, 23.1.3.9
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_map_prototype_object_set (ecma_value_t this_arg, /**< this argument */
ecma_value_t key_arg, /**< key argument */
ecma_value_t value_arg) /**< value argument */
{
return ecma_op_container_set (this_arg, key_arg, value_arg, LIT_MAGIC_STRING_MAP_UL);
} /* ecma_builtin_map_prototype_object_set */
/**
* The Map.prototype object's 'size' getter
*
* See also:
* ECMA-262 v6, 23.1.3.10
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_map_prototype_object_size_getter (ecma_value_t this_arg) /**< this argument */
{
return ecma_op_container_size (this_arg, LIT_MAGIC_STRING_MAP_UL);
} /* ecma_builtin_map_prototype_object_size_getter */
#if ENABLED (JERRY_ESNEXT)
/**
* The Map.prototype object's 'entries' routine
*
* See also:
* ECMA-262 v6, 23.1.3.4
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_map_prototype_object_entries (ecma_value_t this_arg) /**< this argument */
{
return ecma_op_container_create_iterator (this_arg,
ECMA_ITERATOR_KEYS_VALUES,
LIT_MAGIC_STRING_MAP_UL,
ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE,
ECMA_PSEUDO_MAP_ITERATOR);
} /* ecma_builtin_map_prototype_object_entries */
/**
* The Map.prototype object's 'keys' routine
*
* See also:
* ECMA-262 v6, 23.1.3.8
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_map_prototype_object_keys (ecma_value_t this_arg) /**< this argument */
{
return ecma_op_container_create_iterator (this_arg,
ECMA_ITERATOR_KEYS,
LIT_MAGIC_STRING_MAP_UL,
ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE,
ECMA_PSEUDO_MAP_ITERATOR);
} /* ecma_builtin_map_prototype_object_keys */
/**
* The Map.prototype object's 'values' routine
*
* See also:
* ECMA-262 v6, 23.1.3.11
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_map_prototype_object_values (ecma_value_t this_arg) /**< this argument */
{
return ecma_op_container_create_iterator (this_arg,
ECMA_ITERATOR_VALUES,
LIT_MAGIC_STRING_MAP_UL,
ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE,
ECMA_PSEUDO_MAP_ITERATOR);
} /* ecma_builtin_map_prototype_object_values */
#endif /* ENABLED (JERRY_ESNEXT) */
JERRY_UNUSED (arguments_number);
return ecma_builtin_container_dispatch_routine (builtin_routine_id,
this_arg,
arguments_list_p,
LIT_MAGIC_STRING_MAP_UL);
} /* ecma_builtin_map_prototype_dispatch_routine */
/**
* @}
* @}
@@ -38,22 +38,22 @@ STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_CLEAR, ecma_builtin_map_prototype_object_clear, 0, 0)
ROUTINE (LIT_MAGIC_STRING_DELETE, ecma_builtin_map_prototype_object_delete, 1, 1)
ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ecma_builtin_map_prototype_object_foreach, 2, 1)
ROUTINE (LIT_MAGIC_STRING_GET, ecma_builtin_map_prototype_object_get, 1, 1)
ROUTINE (LIT_MAGIC_STRING_HAS, ecma_builtin_map_prototype_object_has, 1, 1)
ROUTINE (LIT_MAGIC_STRING_SET, ecma_builtin_map_prototype_object_set, 2, 2)
ROUTINE (LIT_MAGIC_STRING_CLEAR, ECMA_CONTAINER_ROUTINE_CLEAR, 0, 0)
ROUTINE (LIT_MAGIC_STRING_DELETE, ECMA_CONTAINER_ROUTINE_DELETE, 1, 1)
ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ECMA_CONTAINER_ROUTINE_FOREACH, 2, 1)
ROUTINE (LIT_MAGIC_STRING_GET, ECMA_CONTAINER_ROUTINE_GET, 1, 1)
ROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1)
ROUTINE (LIT_MAGIC_STRING_SET, ECMA_CONTAINER_ROUTINE_SET, 2, 2)
#if ENABLED (JERRY_ESNEXT)
ROUTINE (LIT_MAGIC_STRING_ENTRIES, ecma_builtin_map_prototype_object_entries, 0, 0)
ROUTINE (LIT_MAGIC_STRING_VALUES, ecma_builtin_map_prototype_object_values, 0, 0)
ROUTINE (LIT_MAGIC_STRING_KEYS, ecma_builtin_map_prototype_object_keys, 0, 0)
ROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ecma_builtin_map_prototype_object_entries, 0, 0)
ROUTINE (LIT_MAGIC_STRING_ENTRIES, ECMA_CONTAINER_ROUTINE_ENTRIES, 0, 0)
ROUTINE (LIT_MAGIC_STRING_VALUES, ECMA_CONTAINER_ROUTINE_VALUES, 0, 0)
ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_CONTAINER_ROUTINE_KEYS, 0, 0)
ROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ECMA_CONTAINER_ROUTINE_ENTRIES, 0, 0)
#endif /* ENABLED (JERRY_ESNEXT) */
/* ECMA-262 v6, 23.1.3.10 */
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE,
ecma_builtin_map_prototype_object_size_getter,
ECMA_CONTAINER_ROUTINE_SIZE_GETTER,
ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* ENABLED (JERRY_BUILTIN_MAP) */
@@ -20,6 +20,10 @@
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
/**
* This object has a custom dispatch function.
*/
#define BUILTIN_CUSTOM_DISPATCH
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-set-prototype.inc.h"
#define BUILTIN_UNDERSCORED_ID set_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
@@ -33,168 +37,32 @@
* \addtogroup set ECMA Set object built-in
* @{
*/
/**
* The Set.prototype object's 'add' routine
*
* See also:
* ECMA-262 v6, 23.2.3.1
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_set_prototype_object_add (ecma_value_t this_arg, /**< this argument */
ecma_value_t value_arg) /**< value argument */
{
return ecma_op_container_set (this_arg, value_arg, value_arg, LIT_MAGIC_STRING_SET_UL);
} /* ecma_builtin_set_prototype_object_add */
/**
* The Set.prototype object's 'clear' routine
*
* See also:
* ECMA-262 v6, 23.2.3.2
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_set_prototype_object_clear (ecma_value_t this_arg) /**< this argument */
{
return ecma_op_container_clear (this_arg, LIT_MAGIC_STRING_SET_UL);
} /* ecma_builtin_set_prototype_object_clear */
/**
* The Set.prototype object's 'delete' routine
*
* See also:
* ECMA-262 v6, 23.2.3.4
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_set_prototype_object_delete (ecma_value_t this_arg, /**< this argument */
ecma_value_t value_arg) /**< value argument */
{
return ecma_op_container_delete (this_arg, value_arg, LIT_MAGIC_STRING_SET_UL);
} /* ecma_builtin_set_prototype_object_delete */
/**
* The Set.prototype object's 'forEach' routine
*
* See also:
* ECMA-262 v6, 23.2.3.6
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_set_prototype_object_foreach (ecma_value_t this_arg, /**< this argument */
ecma_value_t predicate, /**< callback function */
ecma_value_t predicate_this_arg) /**< this argument for
* invoke predicate */
{
return ecma_op_container_foreach (this_arg, predicate, predicate_this_arg, LIT_MAGIC_STRING_SET_UL);
} /* ecma_builtin_set_prototype_object_foreach */
/**
* The Set.prototype object's 'has' routine
*
* See also:
* ECMA-262 v6, 23.2.3.7
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_set_prototype_object_has (ecma_value_t this_arg, /**< this argument */
ecma_value_t value_arg) /**< value argument */
{
return ecma_op_container_has (this_arg, value_arg, LIT_MAGIC_STRING_SET_UL);
} /* ecma_builtin_set_prototype_object_has */
/**
* The Set.prototype object's 'size' getter
*
* See also:
* ECMA-262 v6, 23.2.3.9
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_set_prototype_object_size_getter (ecma_value_t this_arg) /**< this argument */
{
return ecma_op_container_size (this_arg, LIT_MAGIC_STRING_SET_UL);
} /* ecma_builtin_set_prototype_object_size_getter */
#if ENABLED (JERRY_ESNEXT)
/**
* The Set.prototype object's 'entries' routine
*
* See also:
* ECMA-262 v6, 23.2.3.5
* Dispatcher of the built-in's routines
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_set_prototype_object_entries (ecma_value_t this_arg) /**< this argument */
ecma_value_t
ecma_builtin_set_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
ecma_length_t arguments_number) /**< length of arguments' list */
{
return ecma_op_container_create_iterator (this_arg,
ECMA_ITERATOR_KEYS_VALUES,
LIT_MAGIC_STRING_SET_UL,
ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE,
ECMA_PSEUDO_SET_ITERATOR);
} /* ecma_builtin_set_prototype_object_entries */
JERRY_UNUSED (arguments_number);
return ecma_builtin_container_dispatch_routine (builtin_routine_id,
this_arg,
arguments_list_p,
LIT_MAGIC_STRING_SET_UL);
} /* ecma_builtin_set_prototype_dispatch_routine */
#endif /* ENABLED (JERRY_ES2015) */
/**
* The Set.prototype object's 'keys' routine
*
* See also:
* ECMA-262 v6, 23.2.3.8
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
* @}
* @}
* @}
*/
static ecma_value_t
ecma_builtin_set_prototype_object_keys (ecma_value_t this_arg) /**< this argument */
{
return ecma_op_container_create_iterator (this_arg,
ECMA_ITERATOR_KEYS,
LIT_MAGIC_STRING_SET_UL,
ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE,
ECMA_PSEUDO_SET_ITERATOR);
} /* ecma_builtin_set_prototype_object_keys */
/**
* The Set.prototype object's 'values' routine
*
* See also:
* ECMA-262 v6, 23.2.3.10
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_set_prototype_object_values (ecma_value_t this_arg) /**< this argument */
{
return ecma_op_container_create_iterator (this_arg,
ECMA_ITERATOR_VALUES,
LIT_MAGIC_STRING_SET_UL,
ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE,
ECMA_PSEUDO_SET_ITERATOR);
} /* ecma_builtin_set_prototype_object_values */
#endif /* ENABLED (JERRY_ESNEXT) */
/**
* @}
* @}
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_SET) */
@@ -38,20 +38,20 @@ STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_ADD, ecma_builtin_set_prototype_object_add, 1, 1)
ROUTINE (LIT_MAGIC_STRING_CLEAR, ecma_builtin_set_prototype_object_clear, 0, 0)
ROUTINE (LIT_MAGIC_STRING_DELETE, ecma_builtin_set_prototype_object_delete, 1, 1)
ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ecma_builtin_set_prototype_object_foreach, 2, 1)
ROUTINE (LIT_MAGIC_STRING_HAS, ecma_builtin_set_prototype_object_has, 1, 1)
ROUTINE (LIT_MAGIC_STRING_CLEAR, ECMA_CONTAINER_ROUTINE_CLEAR, 0, 0)
ROUTINE (LIT_MAGIC_STRING_ADD, ECMA_CONTAINER_ROUTINE_ADD, 1, 1)
ROUTINE (LIT_MAGIC_STRING_DELETE, ECMA_CONTAINER_ROUTINE_DELETE, 1, 1)
ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ECMA_CONTAINER_ROUTINE_FOREACH, 2, 1)
ROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1)
#if ENABLED (JERRY_ESNEXT)
ROUTINE (LIT_MAGIC_STRING_ENTRIES, ecma_builtin_set_prototype_object_entries, 0, 0)
ROUTINE (LIT_MAGIC_STRING_VALUES, ecma_builtin_set_prototype_object_values, 0, 0)
ROUTINE (LIT_MAGIC_STRING_KEYS, ecma_builtin_set_prototype_object_keys, 0, 0)
ROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ecma_builtin_set_prototype_object_values, 0, 0)
ROUTINE (LIT_MAGIC_STRING_ENTRIES, ECMA_CONTAINER_ROUTINE_ENTRIES, 0, 0)
ROUTINE (LIT_MAGIC_STRING_VALUES, ECMA_CONTAINER_ROUTINE_VALUES, 0, 0)
ROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ECMA_CONTAINER_ROUTINE_VALUES, 0, 0)
ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_CONTAINER_ROUTINE_KEYS, 0, 0)
#endif /* ENABLED (JERRY_ESNEXT) */
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE,
ecma_builtin_set_prototype_object_size_getter,
ECMA_CONTAINER_ROUTINE_SIZE_GETTER,
ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* ENABLED (JERRY_BUILTIN_SET) */
@@ -20,6 +20,10 @@
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
/**
* This object has a custom dispatch function.
*/
#define BUILTIN_CUSTOM_DISPATCH
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakmap-prototype.inc.h"
#define BUILTIN_UNDERSCORED_ID weakmap_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
@@ -33,72 +37,26 @@
* \addtogroup weakmap ECMA WeakMap object built-in
* @{
*/
/**
* The WeakMap.prototype object's 'delete' routine
*
* See also:
* ECMA-262 v6, 23.3.3.2
* Dispatcher of the built-in's routines
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_weakmap_prototype_object_delete (ecma_value_t this_arg, /**< this argument */
ecma_value_t key_arg) /**< key argument */
ecma_value_t
ecma_builtin_weakmap_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
ecma_length_t arguments_number) /**< length of arguments' list */
{
return ecma_op_container_delete_weak (this_arg, key_arg, LIT_MAGIC_STRING_WEAKMAP_UL);
} /* ecma_builtin_weakmap_prototype_object_delete */
/**
* The WeakMap.prototype object's 'get' routine
*
* See also:
* ECMA-262 v6, 23.3.3.3
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_weakmap_prototype_object_get (ecma_value_t this_arg, /**< this argument */
ecma_value_t key_arg) /**< key argument */
{
return ecma_op_container_get (this_arg, key_arg, LIT_MAGIC_STRING_WEAKMAP_UL);
} /* ecma_builtin_weakmap_prototype_object_get */
/**
* The WeakMap.prototype object's 'has' routine
*
* See also:
* ECMA-262 v6, 23.3.3.4
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_weakmap_prototype_object_has (ecma_value_t this_arg, /**< this argument */
ecma_value_t key_arg) /**< key argument */
{
return ecma_op_container_has (this_arg, key_arg, LIT_MAGIC_STRING_WEAKMAP_UL);
} /* ecma_builtin_weakmap_prototype_object_has */
/**
* The WeakMap.prototype object's 'set' routine
*
* See also:
* ECMA-262 v6, 23.3.3.5
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_weakmap_prototype_object_set (ecma_value_t this_arg, /**< this argument */
ecma_value_t key_arg, /**< key argument */
ecma_value_t value_arg) /**< value argument */
{
return ecma_op_container_set (this_arg, key_arg, value_arg, LIT_MAGIC_STRING_WEAKMAP_UL);
} /* ecma_builtin_weakmap_prototype_object_set */
JERRY_UNUSED (arguments_number);
return ecma_builtin_container_dispatch_routine (builtin_routine_id,
this_arg,
arguments_list_p,
LIT_MAGIC_STRING_WEAKMAP_UL);
} /* ecma_builtin_weakmap_prototype_dispatch_routine */
/**
* @}
* @}
@@ -36,10 +36,10 @@ STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_DELETE, ecma_builtin_weakmap_prototype_object_delete, 1, 1)
ROUTINE (LIT_MAGIC_STRING_GET, ecma_builtin_weakmap_prototype_object_get, 1, 1)
ROUTINE (LIT_MAGIC_STRING_HAS, ecma_builtin_weakmap_prototype_object_has, 1, 1)
ROUTINE (LIT_MAGIC_STRING_SET, ecma_builtin_weakmap_prototype_object_set, 2, 2)
ROUTINE (LIT_MAGIC_STRING_DELETE, ECMA_CONTAINER_ROUTINE_DELETE_WEAK, 1, 1)
ROUTINE (LIT_MAGIC_STRING_GET, ECMA_CONTAINER_ROUTINE_GET, 1, 1)
ROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1)
ROUTINE (LIT_MAGIC_STRING_SET, ECMA_CONTAINER_ROUTINE_SET, 2, 2)
#endif /* ENABLED (JERRY_BUILTIN_WEAKMAP) */
@@ -20,6 +20,10 @@
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
/**
* This object has a custom dispatch function.
*/
#define BUILTIN_CUSTOM_DISPATCH
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakset-prototype.inc.h"
#define BUILTIN_UNDERSCORED_ID weakset_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
@@ -35,53 +39,25 @@
*/
/**
* The WeakSet.prototype object's 'add' routine
*
* See also:
* ECMA-262 v6, 23.4.3.1
* Dispatcher of the built-in's routines
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_weakset_prototype_object_add (ecma_value_t this_arg, /**< this argument */
ecma_value_t value_arg) /**< value argument */
ecma_value_t
ecma_builtin_weakset_prototype_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine
* identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
ecma_length_t arguments_number) /**< length of arguments' list */
{
return ecma_op_container_set (this_arg, value_arg, ECMA_VALUE_UNDEFINED, LIT_MAGIC_STRING_WEAKSET_UL);
} /* ecma_builtin_weakset_prototype_object_add */
/**
* The WeakSet.prototype object's 'delete' routine
*
* See also:
* ECMA-262 v6, 23.4.3.3
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_weakset_prototype_object_delete (ecma_value_t this_arg, /**< this argument */
ecma_value_t value_arg) /**< value argument */
{
return ecma_op_container_delete_weak (this_arg, value_arg, LIT_MAGIC_STRING_WEAKSET_UL);
} /* ecma_builtin_weakset_prototype_object_delete */
/**
* The WeakSet.prototype object's 'has' routine
*
* See also:
* ECMA-262 v6, 23.4.3.4
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_weakset_prototype_object_has (ecma_value_t this_arg, /**< this argument */
ecma_value_t value_arg) /**< value argument */
{
return ecma_op_container_has (this_arg, value_arg, LIT_MAGIC_STRING_WEAKSET_UL);
} /* ecma_builtin_weakset_prototype_object_has */
JERRY_UNUSED (arguments_number);
return ecma_builtin_container_dispatch_routine (builtin_routine_id,
this_arg,
arguments_list_p,
LIT_MAGIC_STRING_WEAKSET_UL);
} /* ecma_builtin_weakset_prototype_dispatch_routine */
/**
* @}
* @}
@@ -36,9 +36,9 @@ STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_ADD, ecma_builtin_weakset_prototype_object_add, 1, 1)
ROUTINE (LIT_MAGIC_STRING_DELETE, ecma_builtin_weakset_prototype_object_delete, 1, 1)
ROUTINE (LIT_MAGIC_STRING_HAS, ecma_builtin_weakset_prototype_object_has, 1, 1)
ROUTINE (LIT_MAGIC_STRING_ADD, ECMA_CONTAINER_ROUTINE_ADD, 1, 1)
ROUTINE (LIT_MAGIC_STRING_DELETE, ECMA_CONTAINER_ROUTINE_DELETE_WEAK, 1, 1)
ROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1)
#endif /* ENABLED (JERRY_BUILTIN_WEAKSET) */