Merge Map and Set Guards with Container (#4709)

Remove JERRY_BUILTIN_MAP/SET/WEAKMAP/WEAKSET
and replace them with JERRY_BUILTIN_CONTAINER.

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
This commit is contained in:
Tóth Béla
2021-07-12 11:20:38 +02:00
committed by GitHub
parent 7f6a699700
commit 305741a608
33 changed files with 106 additions and 268 deletions
@@ -220,26 +220,27 @@ OBJECT_VALUE (LIT_MAGIC_STRING_PROMISE_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_PROMISE */
#if JERRY_BUILTIN_MAP
#if JERRY_BUILTIN_CONTAINER
/* ECMA-262 v6, 23.1.1.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_WEAKSET_UL,
ECMA_BUILTIN_ID_WEAKSET,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 23.1.1.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_MAP_UL,
ECMA_BUILTIN_ID_MAP,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_MAP */
#if JERRY_BUILTIN_SET
/* ECMA-262 v6, 23.1.1.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_SET_UL,
ECMA_BUILTIN_ID_SET,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_SET */
#if JERRY_BUILTIN_WEAKMAP
/* ECMA-262 v6, 23.1.1.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_WEAKMAP_UL,
ECMA_BUILTIN_ID_WEAKMAP,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_WEAKMAP */
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_WEAKREF
OBJECT_VALUE (LIT_MAGIC_STRING_WEAKREF_UL,
@@ -247,13 +248,6 @@ OBJECT_VALUE (LIT_MAGIC_STRING_WEAKREF_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_WEAKREF */
#if JERRY_BUILTIN_WEAKSET
/* ECMA-262 v6, 23.1.1.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_WEAKSET_UL,
ECMA_BUILTIN_ID_WEAKSET,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_WEAKSET */
#if JERRY_ESNEXT
/* ECMA-262 v6, 19.4.1.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_SYMBOL_UL,
@@ -17,7 +17,7 @@
#include "ecma-builtins.h"
#include "ecma-container-object.h"
#if JERRY_BUILTIN_MAP
#if JERRY_BUILTIN_CONTAINER
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -60,4 +60,4 @@ ecma_builtin_map_iterator_prototype_object_next (ecma_value_t this_val) /**< thi
* @}
*/
#endif /* JERRY_BUILTIN_MAP */
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -19,7 +19,7 @@
#include "ecma-builtin-helpers-macro-defines.inc.h"
#if JERRY_BUILTIN_MAP
#if JERRY_BUILTIN_CONTAINER
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
LIT_MAGIC_STRING_MAP_ITERATOR_UL,
@@ -29,6 +29,6 @@ STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_NEXT, ecma_builtin_map_iterator_prototype_object_next, 0, 0)
#endif /* JERRY_BUILTIN_MAP */
#endif /* JERRY_BUILTIN_CONTAINER */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -15,7 +15,7 @@
#include "ecma-container-object.h"
#if JERRY_BUILTIN_MAP
#if JERRY_BUILTIN_CONTAINER
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -63,4 +63,4 @@ ecma_builtin_map_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< bu
* @}
*/
#endif /* JERRY_BUILTIN_MAP */
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -19,7 +19,7 @@
#include "ecma-builtin-helpers-macro-defines.inc.h"
#if JERRY_BUILTIN_MAP
#if JERRY_BUILTIN_CONTAINER
/* Object properties:
* (property name, object pointer getter) */
@@ -54,6 +54,6 @@ ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE,
ECMA_CONTAINER_ROUTINE_SIZE_GETTER,
ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_BUILTIN_MAP */
#endif /* JERRY_BUILTIN_CONTAINER */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -17,7 +17,7 @@
#include "ecma-exceptions.h"
#include "ecma-container-object.h"
#if JERRY_BUILTIN_MAP
#if JERRY_BUILTIN_CONTAINER
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -83,4 +83,4 @@ ecma_builtin_map_species_get (ecma_value_t this_value) /**< This Value */
* @}
*/
#endif /* JERRY_BUILTIN_MAP */
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -19,7 +19,7 @@
#include "ecma-builtin-helpers-macro-defines.inc.h"
#if JERRY_BUILTIN_MAP
#if JERRY_BUILTIN_CONTAINER
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
@@ -47,6 +47,6 @@ ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
ecma_builtin_map_species_get,
ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_BUILTIN_MAP */
#endif /* JERRY_BUILTIN_CONTAINER */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -17,7 +17,7 @@
#include "ecma-builtins.h"
#include "ecma-container-object.h"
#if JERRY_BUILTIN_SET
#if JERRY_BUILTIN_CONTAINER
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -60,4 +60,4 @@ ecma_builtin_set_iterator_prototype_object_next (ecma_value_t this_val) /**< thi
* @}
*/
#endif /* JERRY_BUILTIN_SET */
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -19,7 +19,7 @@
#include "ecma-builtin-helpers-macro-defines.inc.h"
#if JERRY_BUILTIN_SET
#if JERRY_BUILTIN_CONTAINER
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
LIT_MAGIC_STRING_SET_ITERATOR_UL,
@@ -29,6 +29,6 @@ STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_NEXT, ecma_builtin_set_iterator_prototype_object_next, 0, 0)
#endif /* JERRY_BUILTIN_SET */
#endif /* JERRY_BUILTIN_CONTAINER */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -15,7 +15,7 @@
#include "ecma-container-object.h"
#if JERRY_BUILTIN_SET
#if JERRY_BUILTIN_CONTAINER
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -62,4 +62,4 @@ ecma_builtin_set_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< bu
* @}
*/
#endif /* JERRY_BUILTIN_SET */
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -19,7 +19,7 @@
#include "ecma-builtin-helpers-macro-defines.inc.h"
#if JERRY_BUILTIN_SET
#if JERRY_BUILTIN_CONTAINER
/* Object properties:
* (property name, object pointer getter) */
@@ -53,6 +53,6 @@ ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE,
ECMA_CONTAINER_ROUTINE_SIZE_GETTER,
ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_BUILTIN_SET */
#endif /* JERRY_BUILTIN_CONTAINER */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -17,7 +17,7 @@
#include "ecma-exceptions.h"
#include "ecma-container-object.h"
#if JERRY_BUILTIN_SET
#if JERRY_BUILTIN_CONTAINER
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -83,4 +83,4 @@ ecma_builtin_set_species_get (ecma_value_t this_value) /**< This Value */
* @}
*/
#endif /* JERRY_BUILTIN_SET */
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -19,7 +19,7 @@
#include "ecma-builtin-helpers-macro-defines.inc.h"
#if JERRY_BUILTIN_SET
#if JERRY_BUILTIN_CONTAINER
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
@@ -47,6 +47,6 @@ ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
ecma_builtin_set_species_get,
ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_BUILTIN_SET */
#endif /* JERRY_BUILTIN_CONTAINER */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -15,7 +15,7 @@
#include "ecma-container-object.h"
#if JERRY_BUILTIN_WEAKMAP
#if JERRY_BUILTIN_CONTAINER
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -62,4 +62,4 @@ ecma_builtin_weakmap_prototype_dispatch_routine (uint8_t builtin_routine_id, /**
* @}
*/
#endif /* JERRY_BUILTIN_WEAKMAP */
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -19,7 +19,7 @@
#include "ecma-builtin-helpers-macro-defines.inc.h"
#if JERRY_BUILTIN_WEAKMAP
#if JERRY_BUILTIN_CONTAINER
/* Object properties:
* (property name, object pointer getter) */
@@ -41,6 +41,6 @@ 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 /* JERRY_BUILTIN_WEAKMAP */
#endif /* JERRY_BUILTIN_CONTAINER */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -17,7 +17,7 @@
#include "ecma-exceptions.h"
#include "ecma-container-object.h"
#if JERRY_BUILTIN_WEAKMAP
#if JERRY_BUILTIN_CONTAINER
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -71,4 +71,4 @@ ecma_builtin_weakmap_dispatch_construct (const ecma_value_t *arguments_list_p, /
* @}
*/
#endif /* JERRY_BUILTIN_WEAKMAP */
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -19,7 +19,7 @@
#include "ecma-builtin-helpers-macro-defines.inc.h"
#if JERRY_BUILTIN_WEAKMAP
#if JERRY_BUILTIN_CONTAINER
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
@@ -42,6 +42,6 @@ OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE,
ECMA_PROPERTY_FIXED)
#endif /* JERRY_BUILTIN_WEAKMAP */
#endif /* JERRY_BUILTIN_CONTAINER */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -15,7 +15,7 @@
#include "ecma-container-object.h"
#if JERRY_BUILTIN_WEAKSET
#if JERRY_BUILTIN_CONTAINER
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -64,4 +64,4 @@ ecma_builtin_weakset_prototype_dispatch_routine (uint8_t builtin_routine_id, /**
* @}
*/
#endif /* JERRY_BUILTIN_WEAKSET */
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -19,7 +19,7 @@
#include "ecma-builtin-helpers-macro-defines.inc.h"
#if JERRY_BUILTIN_WEAKSET
#if JERRY_BUILTIN_CONTAINER
/* Object properties:
* (property name, object pointer getter) */
@@ -40,6 +40,6 @@ 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 /* JERRY_BUILTIN_WEAKSET */
#endif /* JERRY_BUILTIN_CONTAINER */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -17,7 +17,7 @@
#include "ecma-exceptions.h"
#include "ecma-container-object.h"
#if JERRY_BUILTIN_WEAKSET
#if JERRY_BUILTIN_CONTAINER
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -71,4 +71,4 @@ ecma_builtin_weakset_dispatch_construct (const ecma_value_t *arguments_list_p, /
* @}
*/
#endif /* JERRY_BUILTIN_WEAKSET */
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -19,7 +19,7 @@
#include "ecma-builtin-helpers-macro-defines.inc.h"
#if JERRY_BUILTIN_WEAKSET
#if JERRY_BUILTIN_CONTAINER
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
@@ -42,6 +42,6 @@ OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE,
ECMA_PROPERTY_FIXED)
#endif /* JERRY_BUILTIN_WEAKSET */
#endif /* JERRY_BUILTIN_CONTAINER */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -509,7 +509,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROMISE,
#endif /* JERRY_BUILTIN_PROMISE */
#if JERRY_BUILTIN_MAP
#if JERRY_BUILTIN_CONTAINER
/* The Map prototype object (23.1.3) */
BUILTIN (ECMA_BUILTIN_ID_MAP_PROTOTYPE,
@@ -525,10 +525,6 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_MAP,
true,
map)
#endif /* JERRY_BUILTIN_MAP */
#if JERRY_BUILTIN_SET
/* The Set prototype object (23.1.3) */
BUILTIN (ECMA_BUILTIN_ID_SET_PROTOTYPE,
ECMA_OBJECT_TYPE_GENERAL,
@@ -543,10 +539,6 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SET,
true,
set)
#endif /* JERRY_BUILTIN_SET */
#if JERRY_BUILTIN_WEAKMAP
/* The WeakMap prototype object (23.1.3) */
BUILTIN (ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE,
ECMA_OBJECT_TYPE_GENERAL,
@@ -561,10 +553,6 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKMAP,
true,
weakmap)
#endif /* JERRY_BUILTIN_WEAKMAP */
#if JERRY_BUILTIN_WEAKSET
/* The WeakSet prototype object (23.1.3) */
BUILTIN (ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE,
ECMA_OBJECT_TYPE_GENERAL,
@@ -579,7 +567,7 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKSET,
true,
weakset)
#endif /* JERRY_BUILTIN_WEAKSET */
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_WEAKREF
@@ -729,23 +717,21 @@ BUILTIN (ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE,
true,
async_generator_prototype)
#if JERRY_BUILTIN_SET
#if JERRY_BUILTIN_CONTAINER
/* The %SetIteratorPrototype% object (ECMA-262 v6, 23.2.5.2) */
BUILTIN (ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE,
ECMA_OBJECT_TYPE_GENERAL,
ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE,
true,
set_iterator_prototype)
#endif /* JERRY_BUILTIN_SET */
#if JERRY_BUILTIN_MAP
/* The %MapIteratorPrototype% object (ECMA-262 v6, 23.1.5.2) */
BUILTIN (ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE,
ECMA_OBJECT_TYPE_GENERAL,
ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE,
true,
map_iterator_prototype)
#endif /* JERRY_BUILTIN_SET */
#endif /* JERRY_BUILTIN_CONTAINER */
#endif /* JERRY_ESNEXT */