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
+6 -18
View File
@@ -327,7 +327,7 @@ ecma_gc_mark_properties (ecma_object_t *object_p, /**< object */
break;
}
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_WEAKMAP
#if JERRY_BUILTIN_CONTAINER
case LIT_INTERNAL_MAGIC_STRING_WEAK_REFS:
{
ecma_value_t key_arg = ecma_make_object_value (object_p);
@@ -366,7 +366,7 @@ ecma_gc_mark_properties (ecma_object_t *object_p, /**< object */
}
break;
}
#endif /* JERRY_BUILTIN_WEAKMAP */
#endif /* JERRY_BUILTIN_CONTAINER */
case LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER_WITH_REFERENCES:
{
jerry_value_t value = property_pair_p->values[index].value;
@@ -505,7 +505,7 @@ ecma_gc_mark_promise_object (ecma_extended_object_t *ext_object_p) /**< extended
#endif /* JERRY_BUILTIN_PROMISE */
#if JERRY_BUILTIN_MAP
#if JERRY_BUILTIN_CONTAINER
/**
* Mark objects referenced by Map built-in.
*/
@@ -540,9 +540,7 @@ ecma_gc_mark_map_object (ecma_object_t *object_p) /**< object */
}
}
} /* ecma_gc_mark_map_object */
#endif /* JERRY_BUILTIN_MAP */
#if JERRY_BUILTIN_WEAKMAP
/**
* Mark objects referenced by WeakMap built-in.
*/
@@ -575,9 +573,7 @@ ecma_gc_mark_weakmap_object (ecma_object_t *object_p) /**< object */
}
}
} /* ecma_gc_mark_weakmap_object */
#endif /* JERRY_BUILTIN_WEAKMAP */
#if JERRY_BUILTIN_SET
/**
* Mark objects referenced by Set built-in.
*/
@@ -607,7 +603,7 @@ ecma_gc_mark_set_object (ecma_object_t *object_p) /**< object */
}
}
} /* ecma_gc_mark_set_object */
#endif /* JERRY_BUILTIN_SET */
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_ESNEXT
/**
@@ -939,30 +935,22 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
#if JERRY_BUILTIN_CONTAINER
case ECMA_OBJECT_CLASS_CONTAINER:
{
#if JERRY_BUILTIN_MAP
if (ext_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_MAP_UL)
{
ecma_gc_mark_map_object (object_p);
break;
}
#endif /* JERRY_BUILTIN_MAP */
#if JERRY_BUILTIN_WEAKMAP
if (ext_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKMAP_UL)
{
ecma_gc_mark_weakmap_object (object_p);
break;
}
#endif /* JERRY_BUILTIN_WEAKMAP */
#if JERRY_BUILTIN_SET
if (ext_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_SET_UL)
{
ecma_gc_mark_set_object (object_p);
break;
}
#endif /* JERRY_BUILTIN_SET */
#if JERRY_BUILTIN_WEAKSET
JERRY_ASSERT (ext_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKSET_UL);
#endif /* JERRY_BUILTIN_WEAKSET */
break;
}
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -1567,7 +1555,7 @@ ecma_gc_free_property (ecma_object_t *object_p, /**< object */
break;
}
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET || JERRY_BUILTIN_WEAKREF
#if JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER
case LIT_INTERNAL_MAGIC_STRING_WEAK_REFS:
{
ecma_collection_t *refs_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, value);
@@ -1592,7 +1580,7 @@ ecma_gc_free_property (ecma_object_t *object_p, /**< object */
ecma_collection_destroy (refs_p);
break;
}
#endif /* JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET || JERRY_BUILTIN_WEAKREF */
#endif /* JERRY_BUILTIN_CONTAINER */
default:
{
JERRY_ASSERT (name_cp == LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER
+2 -2
View File
@@ -295,10 +295,10 @@ ecma_string_t *ecma_new_symbol_from_descriptor_string (ecma_value_t string_desc)
bool ecma_prop_name_is_symbol (ecma_string_t *string_p);
ecma_length_t ecma_op_advance_string_index (ecma_string_t *str_p, ecma_length_t index_num, bool is_unicode);
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_MAP || JERRY_BUILTIN_SET
#if JERRY_BUILTIN_CONTAINER
ecma_string_t *ecma_new_map_key_string (ecma_value_t value);
bool ecma_prop_name_is_map_key (ecma_string_t *string_p);
#endif /* JERRY_BUILTIN_MAP || JERRY_BUILTIN_SET */
#endif /* JERRY_BUILTIN_CONTAINER */
ecma_string_t *ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size);
ecma_string_t *ecma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string_p,
lit_utf8_size_t string_size);
@@ -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 */
@@ -184,7 +184,6 @@ ecma_op_container_entry_size (lit_magic_string_id_t lit_id) /**< class id */
return ECMA_CONTAINER_VALUE_SIZE;
} /* ecma_op_container_entry_size */
#if JERRY_BUILTIN_WEAKSET
/**
* Release the entries in the WeakSet container.
*/
@@ -213,9 +212,7 @@ ecma_op_container_free_weakset_entries (ecma_object_t *object_p, /**< object poi
*entry_p = ECMA_VALUE_EMPTY;
}
} /* ecma_op_container_free_weakset_entries */
#endif /* JERRY_BUILTIN_WEAKSET */
#if JERRY_BUILTIN_WEAKMAP
/**
* Release the entries in the WeakMap container.
*/
@@ -247,9 +244,7 @@ ecma_op_container_free_weakmap_entries (ecma_object_t *object_p, /**< object poi
entry_p->value = ECMA_VALUE_EMPTY;
}
} /* ecma_op_container_free_weakmap_entries */
#endif /* JERRY_BUILTIN_WEAKMAP */
#if JERRY_BUILTIN_SET
/**
* Release the entries in the Set container.
*/
@@ -274,9 +269,7 @@ ecma_op_container_free_set_entries (ecma_collection_t *container_p)
*entry_p = ECMA_VALUE_EMPTY;
}
} /* ecma_op_container_free_set_entries */
#endif /* JERRY_BUILTIN_SET */
#if JERRY_BUILTIN_MAP
/**
* Release the entries in the Map container.
*/
@@ -304,7 +297,6 @@ ecma_op_container_free_map_entries (ecma_collection_t *container_p)
entry_p->value = ECMA_VALUE_EMPTY;
}
} /* ecma_op_container_free_map_entries */
#endif /* JERRY_BUILTIN_MAP */
/**
* Release the internal buffer and the stored entries.
@@ -320,34 +312,26 @@ ecma_op_container_free_entries (ecma_object_t *object_p) /**< collection object
switch (map_object_p->u.cls.u2.container_id)
{
#if JERRY_BUILTIN_WEAKSET
case LIT_MAGIC_STRING_WEAKSET_UL:
{
ecma_op_container_free_weakset_entries (object_p, container_p);
break;
}
#endif /* JERRY_BUILTIN_WEAKSET */
#if JERRY_BUILTIN_WEAKMAP
case LIT_MAGIC_STRING_WEAKMAP_UL:
{
ecma_op_container_free_weakmap_entries (object_p, container_p);
break;
}
#endif /* JERRY_BUILTIN_WEAKMAP */
#if JERRY_BUILTIN_SET
case LIT_MAGIC_STRING_SET_UL:
{
ecma_op_container_free_set_entries (container_p);
break;
}
#endif /* JERRY_BUILTIN_SET */
#if JERRY_BUILTIN_MAP
case LIT_MAGIC_STRING_MAP_UL:
{
ecma_op_container_free_map_entries (container_p);
break;
}
#endif /* JERRY_BUILTIN_MAP */
default:
{
break;
@@ -610,12 +594,10 @@ ecma_op_container_get (ecma_extended_object_t *map_object_p, /**< map object */
ecma_value_t key_arg, /**< key argument */
lit_magic_string_id_t lit_id) /**< internal class id */
{
#if JERRY_BUILTIN_WEAKMAP
if (lit_id == LIT_MAGIC_STRING_WEAKMAP_UL && !ecma_is_value_object (key_arg))
{
return ECMA_VALUE_UNDEFINED;
}
#endif /* JERRY_BUILTIN_WEAKMAP */
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
map_object_p->u.cls.u3.value);
@@ -649,13 +631,11 @@ ecma_op_container_has (ecma_extended_object_t *map_object_p, /**< map object */
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
map_object_p->u.cls.u3.value);
#if JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET
if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0
&& !ecma_is_value_object (key_arg))
{
return ECMA_VALUE_FALSE;
}
#endif /* JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET */
if (ECMA_CONTAINER_GET_SIZE (container_p) == 0)
{
@@ -707,13 +687,11 @@ ecma_op_container_set (ecma_extended_object_t *map_object_p, /**< map object */
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
map_object_p->u.cls.u3.value);
#if JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET
if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0
&& !ecma_is_value_object (key_arg))
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Key must be an object"));
}
#endif /* JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET */
ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id);
@@ -724,13 +702,11 @@ ecma_op_container_set (ecma_extended_object_t *map_object_p, /**< map object */
value_arg,
lit_id);
#if JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET
if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0)
{
ecma_object_t *key_p = ecma_get_object_from_value (key_arg);
ecma_op_object_set_weak (key_p, (ecma_object_t *) map_object_p);
}
#endif /* JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET */
}
else
{
+2 -2
View File
@@ -135,7 +135,7 @@ ecma_op_same_value (ecma_value_t x, /**< ecma value */
return false;
} /* ecma_op_same_value */
#if JERRY_BUILTIN_MAP
#if JERRY_BUILTIN_CONTAINER
/**
* SameValueZero operation.
*
@@ -182,7 +182,7 @@ ecma_op_same_value_zero (ecma_value_t x, /**< ecma value */
return ecma_op_same_value (x, y);
} /* ecma_op_same_value_zero */
#endif /* JERRY_BUILTIN_MAP */
#endif /* JERRY_BUILTIN_CONTAINER */
/**
* ToPrimitive operation.
+2 -2
View File
@@ -49,9 +49,9 @@ typedef enum
bool ecma_op_require_object_coercible (ecma_value_t value);
bool ecma_op_same_value (ecma_value_t x, ecma_value_t y);
#if JERRY_BUILTIN_MAP
#if JERRY_BUILTIN_CONTAINER
bool ecma_op_same_value_zero (ecma_value_t x, ecma_value_t y, bool strict_equality);
#endif /* JERRY_BUILTIN_MAP */
#endif /* JERRY_BUILTIN_CONTAINER */
ecma_value_t ecma_op_to_primitive (ecma_value_t value, ecma_preferred_type_hint_t preferred_type);
bool ecma_op_to_boolean (ecma_value_t value);
ecma_value_t ecma_op_to_number (ecma_value_t value, ecma_number_t *number_p);
+7 -15
View File
@@ -2796,27 +2796,19 @@ ecma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_MAP
#if JERRY_BUILTIN_CONTAINER
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_MAP_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SET_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE)
#if JERRY_ESNEXT
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_MAP */
#if JERRY_BUILTIN_SET
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SET_PROTOTYPE)
#if JERRY_ESNEXT
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_SET */
#if JERRY_BUILTIN_WEAKMAP
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE)
#endif /* JERRY_BUILTIN_WEAKMAP */
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_WEAKREF
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE)
#endif /* JERRY_BUILTIN_WEAKREF */
#if JERRY_BUILTIN_WEAKSET
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE)
#endif /* JERRY_BUILTIN_WEAKSET */
#if JERRY_BUILTIN_DATAVIEW
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE)
#endif /* JERRY_BUILTIN_DATAVIEW */
@@ -3430,7 +3422,7 @@ ecma_op_ordinary_object_has_own_property (ecma_object_t *object_p, /**< the obje
return property != ECMA_PROPERTY_TYPE_NOT_FOUND && property != ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP;
} /* ecma_op_ordinary_object_has_own_property */
#if JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_WEAKSET || JERRY_BUILTIN_WEAKMAP
#if JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER
/**
* Set a weak reference from a container or WeakRefObject to a key object
@@ -3505,7 +3497,7 @@ ecma_op_object_unref_weak (ecma_object_t *object_p, /**< this argument */
}
} /* ecma_op_object_unref_weak */
#endif /* JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_WEAKSET || JERRY_BUILTIN_WEAKMAP */
#endif /* JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER */
/**
* Raise property redefinition error
*
+2 -2
View File
@@ -111,10 +111,10 @@ ecma_value_t ecma_op_species_constructor (ecma_object_t *this_value, ecma_builti
ecma_value_t ecma_op_invoke_by_symbol_id (ecma_value_t object, lit_magic_string_id_t magic_string_id,
ecma_value_t *args_p, uint32_t args_len);
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_WEAKSET || JERRY_BUILTIN_WEAKMAP
#if JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER
void ecma_op_object_set_weak (ecma_object_t *object_p, ecma_object_t *target_p);
void ecma_op_object_unref_weak (ecma_object_t *object_p, ecma_value_t ref_holder);
#endif /* JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_WEAKSET || JERRY_BUILTIN_WEAKMAP */
#endif /* JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER */
ecma_value_t ecma_op_invoke (ecma_value_t object, ecma_string_t *property_name_p, ecma_value_t *args_p,
uint32_t args_len);
ecma_value_t ecma_op_invoke_by_magic_id (ecma_value_t object, lit_magic_string_id_t magic_string_id,