Skip to content

Commit 0569326

Browse files
committed
Add custom dispatcher to every builtin object for consistency
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
1 parent 053bfa0 commit 0569326

File tree

112 files changed

+1539
-415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1539
-415
lines changed

jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c

+23
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,27 @@
3333
#define BUILTIN_UNDERSCORED_ID aggregate_error_prototype
3434
#include "ecma-builtin-internal-routines-template.inc.h"
3535

36+
/**
37+
* Dispatcher of the built-in's routines
38+
*
39+
* @return ecma value
40+
* Returned value must be freed with ecma_free_value.
41+
*/
42+
ecma_value_t
43+
ecma_builtin_aggregate_error_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide
44+
* routine identifier */
45+
ecma_value_t this_arg, /**< 'this' argument value */
46+
const ecma_value_t arguments_list_p[], /**< list of arguments
47+
* passed
48+
* to routine */
49+
uint32_t arguments_number) /**< length of arguments' list */
50+
{
51+
JERRY_UNUSED (this_arg);
52+
JERRY_UNUSED (arguments_number);
53+
JERRY_UNUSED (arguments_list_p);
54+
JERRY_UNUSED (builtin_routine_id);
55+
56+
JERRY_UNREACHABLE ();
57+
} /* ecma_builtin_aggregate_error_prototype_dispatch_routine */
58+
3659
#endif /* JERRY_ESNEXT */

jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.c

+21
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,27 @@ ecma_builtin_aggregate_error_dispatch_construct (const ecma_value_t *arguments_l
103103
return result;
104104
} /* ecma_builtin_aggregate_error_dispatch_construct */
105105

106+
/**
107+
* Dispatcher of the built-in's routines
108+
*
109+
* @return ecma value
110+
* Returned value must be freed with ecma_free_value.
111+
*/
112+
ecma_value_t
113+
ecma_builtin_aggregate_error_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
114+
ecma_value_t this_arg, /**< 'this' argument value */
115+
const ecma_value_t arguments_list_p[], /**< list of arguments
116+
* passed to routine */
117+
uint32_t arguments_number) /**< length of arguments' list */
118+
{
119+
JERRY_UNUSED (this_arg);
120+
JERRY_UNUSED (arguments_number);
121+
JERRY_UNUSED (arguments_list_p);
122+
JERRY_UNUSED (builtin_routine_id);
123+
124+
JERRY_UNREACHABLE ();
125+
} /* ecma_builtin_aggregate_error_dispatch_routine */
126+
106127
/**
107128
* @}
108129
* @}

jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c

-5
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@
2424
#define ECMA_BUILTINS_INTERNAL
2525
#include "ecma-builtins-internal.h"
2626

27-
/**
28-
* This object has a custom dispatch function.
29-
*/
30-
#define BUILTIN_CUSTOM_DISPATCH
31-
3227
/**
3328
* List of built-in routine identifiers.
3429
*/

jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c

+23
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,27 @@
2525
#define BUILTIN_UNDERSCORED_ID array_prototype_unscopables
2626
#include "ecma-builtin-internal-routines-template.inc.h"
2727

28+
/**
29+
* Dispatcher of the built-in's routines
30+
*
31+
* @return ecma value
32+
* Returned value must be freed with ecma_free_value.
33+
*/
34+
ecma_value_t
35+
ecma_builtin_array_prototype_unscopables_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide
36+
* routine identifier */
37+
ecma_value_t this_arg, /**< 'this' argument value */
38+
const ecma_value_t arguments_list_p[], /**< list of arguments
39+
* passed
40+
* to routine */
41+
uint32_t arguments_number) /**< length of arguments' list */
42+
{
43+
JERRY_UNUSED (this_arg);
44+
JERRY_UNUSED (arguments_number);
45+
JERRY_UNUSED (arguments_list_p);
46+
JERRY_UNUSED (builtin_routine_id);
47+
48+
JERRY_UNREACHABLE ();
49+
} /* ecma_builtin_array_prototype_unscopables_dispatch_routine */
50+
2851
#endif /* JERRY_ESNEXT */

jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c

-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@
3434
#define ECMA_BUILTINS_INTERNAL
3535
#include "ecma-builtins-internal.h"
3636

37-
/**
38-
* This object has a custom dispatch function.
39-
*/
40-
#define BUILTIN_CUSTOM_DISPATCH
41-
4237
/**
4338
* List of built-in routine identifiers.
4439
*/

jerry-core/ecma/builtin-objects/ecma-builtin-array.c

-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
#define ECMA_BUILTINS_INTERNAL
3434
#include "ecma-builtins-internal.h"
3535

36-
/**
37-
* This object has a custom dispatch function.
38-
*/
39-
#define BUILTIN_CUSTOM_DISPATCH
40-
4136
/**
4237
* List of built-in routine identifiers.
4338
*/

jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c

+42
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@
3131
#define ECMA_BUILTINS_INTERNAL
3232
#include "ecma-builtins-internal.h"
3333

34+
/**
35+
* List of built-in routine identifiers.
36+
*/
37+
enum
38+
{
39+
ECMA_ARRAYBUFFER_PROTOTYPE_ROUTINE_START = 0,
40+
ECMA_ARRAYBUFFER_PROTOTYPE_SLICE,
41+
ECMA_ARRAYBUFFER_PROTOTYPE_BYTELENGTH_GETTER,
42+
};
43+
3444
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-arraybuffer-prototype.inc.h"
3545
#define BUILTIN_UNDERSCORED_ID arraybuffer_prototype
3646
#include "ecma-builtin-internal-routines-template.inc.h"
@@ -106,6 +116,38 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi
106116
return ecma_builtin_arraybuffer_slice (this_arg, argument_list_p, arguments_number);
107117
} /* ecma_builtin_arraybuffer_prototype_object_slice */
108118

119+
/**
120+
* Dispatcher of the built-in's routines
121+
*
122+
* @return ecma value
123+
* Returned value must be freed with ecma_free_value.
124+
*/
125+
ecma_value_t
126+
ecma_builtin_arraybuffer_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide
127+
*routine
128+
*identifier */
129+
ecma_value_t this_arg, /**< 'this' argument value */
130+
const ecma_value_t arguments_list_p[], /**< list of arguments
131+
* passed to routine */
132+
uint32_t arguments_number) /**< length of arguments' list */
133+
{
134+
switch (builtin_routine_id)
135+
{
136+
case ECMA_ARRAYBUFFER_PROTOTYPE_SLICE:
137+
{
138+
return ecma_builtin_arraybuffer_prototype_object_slice (this_arg, arguments_list_p, arguments_number);
139+
}
140+
case ECMA_ARRAYBUFFER_PROTOTYPE_BYTELENGTH_GETTER:
141+
{
142+
return ecma_builtin_arraybuffer_prototype_bytelength_getter (this_arg);
143+
}
144+
default:
145+
{
146+
JERRY_UNREACHABLE ();
147+
}
148+
}
149+
} /* ecma_builtin_arraybuffer_prototype_dispatch_routine */
150+
109151
/**
110152
* @}
111153
* @}

jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
3030

3131
/* Readonly accessor properties */
3232
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,
33-
ecma_builtin_arraybuffer_prototype_bytelength_getter,
33+
ECMA_ARRAYBUFFER_PROTOTYPE_BYTELENGTH_GETTER,
3434
ECMA_PROPERTY_FLAG_CONFIGURABLE)
3535

3636
/* ECMA-262 v6, 24.1.4.4 */
@@ -40,7 +40,7 @@ STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
4040

4141
/* Routine properties:
4242
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
43-
ROUTINE (LIT_MAGIC_STRING_SLICE, ecma_builtin_arraybuffer_prototype_object_slice, NON_FIXED, 2)
43+
ROUTINE (LIT_MAGIC_STRING_SLICE, ECMA_ARRAYBUFFER_PROTOTYPE_SLICE, NON_FIXED, 2)
4444

4545
#endif /* JERRY_BUILTIN_TYPEDARRAY */
4646

jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c

+36-6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@
2828
#define ECMA_BUILTINS_INTERNAL
2929
#include "ecma-builtins-internal.h"
3030

31+
/**
32+
* List of built-in routine identifiers.
33+
*/
34+
enum
35+
{
36+
ECMA_ARRAYBUFFER_ROUTINE_START = 0,
37+
ECMA_ARRAYBUFFER_OBJECT_IS_VIEW,
38+
ECMA_ARRAYBUFFER_SPECIES_GET,
39+
};
40+
3141
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-arraybuffer.inc.h"
3242
#define BUILTIN_UNDERSCORED_ID arraybuffer
3343
#include "ecma-builtin-internal-routines-template.inc.h"
@@ -93,16 +103,36 @@ ecma_builtin_arraybuffer_dispatch_construct (const ecma_value_t *arguments_list_
93103
} /* ecma_builtin_arraybuffer_dispatch_construct */
94104

95105
/**
96-
* 24.1.3.3 get ArrayBuffer [ @@species ] accessor
106+
* Dispatcher of the built-in's routines
97107
*
98-
* @return ecma_value
99-
* returned value must be freed with ecma_free_value
108+
* @return ecma value
109+
* Returned value must be freed with ecma_free_value.
100110
*/
101111
ecma_value_t
102-
ecma_builtin_arraybuffer_species_get (ecma_value_t this_value) /**< This Value */
112+
ecma_builtin_arraybuffer_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
113+
ecma_value_t this_arg, /**< 'this' argument value */
114+
const ecma_value_t arguments_list_p[], /**< list of arguments
115+
* passed to routine */
116+
uint32_t arguments_number) /**< length of arguments' list */
103117
{
104-
return ecma_copy_value (this_value);
105-
} /* ecma_builtin_arraybuffer_species_get */
118+
JERRY_UNUSED (arguments_number);
119+
120+
switch (builtin_routine_id)
121+
{
122+
case ECMA_ARRAYBUFFER_OBJECT_IS_VIEW:
123+
{
124+
return ecma_builtin_arraybuffer_object_is_view (this_arg, arguments_list_p[0]);
125+
}
126+
case ECMA_ARRAYBUFFER_SPECIES_GET:
127+
{
128+
return ecma_copy_value (this_arg);
129+
}
130+
default:
131+
{
132+
JERRY_UNREACHABLE ();
133+
}
134+
}
135+
} /* ecma_builtin_arraybuffer_dispatch_routine */
106136

107137
/**
108138
* @}

jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ STRING_VALUE (LIT_MAGIC_STRING_NAME,
4343
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
4444

4545
/* ES2015 24.1.3.1 */
46-
ROUTINE (LIT_MAGIC_STRING_IS_VIEW_UL, ecma_builtin_arraybuffer_object_is_view, 1, 1)
46+
ROUTINE (LIT_MAGIC_STRING_IS_VIEW_UL, ECMA_ARRAYBUFFER_OBJECT_IS_VIEW, 1, 1)
4747

4848
/* ES2015 24.1.3.3 */
4949
ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
50-
ecma_builtin_arraybuffer_species_get,
50+
ECMA_ARRAYBUFFER_SPECIES_GET,
5151
ECMA_PROPERTY_FLAG_CONFIGURABLE)
5252

5353
#endif /* JERRY_BUILTIN_TYPEDARRAY */

jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.c

+22
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,28 @@
3434
* @{
3535
*/
3636

37+
/**
38+
* Dispatcher of the built-in's routines
39+
*
40+
* @return ecma value
41+
* Returned value must be freed with ecma_free_value.
42+
*/
43+
ecma_value_t
44+
ecma_builtin_async_function_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide
45+
* routine identifier */
46+
ecma_value_t this_arg, /**< 'this' argument value */
47+
const ecma_value_t arguments_list_p[], /**< list of arguments
48+
* passed to routine */
49+
uint32_t arguments_number) /**< length of arguments' list */
50+
{
51+
JERRY_UNUSED (this_arg);
52+
JERRY_UNUSED (arguments_number);
53+
JERRY_UNUSED (arguments_list_p);
54+
JERRY_UNUSED (builtin_routine_id);
55+
56+
JERRY_UNREACHABLE ();
57+
} /* ecma_builtin_async_function_prototype_dispatch_routine */
58+
3759
/**
3860
* @}
3961
* @}

jerry-core/ecma/builtin-objects/ecma-builtin-async-function.c

+21
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,27 @@ ecma_builtin_async_function_dispatch_construct (const ecma_value_t *arguments_li
6565
return ecma_builtin_async_function_dispatch_call (arguments_list_p, arguments_list_len);
6666
} /* ecma_builtin_async_function_dispatch_construct */
6767

68+
/**
69+
* Dispatcher of the built-in's routines
70+
*
71+
* @return ecma value
72+
* Returned value must be freed with ecma_free_value.
73+
*/
74+
ecma_value_t
75+
ecma_builtin_async_function_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
76+
ecma_value_t this_arg, /**< 'this' argument value */
77+
const ecma_value_t arguments_list_p[], /**< list of arguments
78+
* passed to routine */
79+
uint32_t arguments_number) /**< length of arguments' list */
80+
{
81+
JERRY_UNUSED (this_arg);
82+
JERRY_UNUSED (arguments_number);
83+
JERRY_UNUSED (arguments_list_p);
84+
JERRY_UNUSED (builtin_routine_id);
85+
86+
JERRY_UNREACHABLE ();
87+
} /* ecma_builtin_async_function_dispatch_routine */
88+
6889
/**
6990
* @}
7091
* @}

jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.c

+22
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,28 @@ ecma_builtin_async_generator_function_dispatch_construct (const ecma_value_t *ar
6565
return ecma_builtin_async_generator_function_dispatch_call (arguments_list_p, arguments_list_len);
6666
} /* ecma_builtin_async_generator_function_dispatch_construct */
6767

68+
/**
69+
* Dispatcher of the built-in's routines
70+
*
71+
* @return ecma value
72+
* Returned value must be freed with ecma_free_value.
73+
*/
74+
ecma_value_t
75+
ecma_builtin_async_generator_function_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide
76+
* routine identifier */
77+
ecma_value_t this_arg, /**< 'this' argument value */
78+
const ecma_value_t arguments_list_p[], /**< list of arguments
79+
* passed to routine */
80+
uint32_t arguments_number) /**< length of arguments' list */
81+
{
82+
JERRY_UNUSED (this_arg);
83+
JERRY_UNUSED (arguments_number);
84+
JERRY_UNUSED (arguments_list_p);
85+
JERRY_UNUSED (builtin_routine_id);
86+
87+
JERRY_UNREACHABLE ();
88+
} /* ecma_builtin_async_generator_function_dispatch_routine */
89+
6890
/**
6991
* @}
7092
* @}

jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c

-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
#define ECMA_BUILTINS_INTERNAL
3131
#include "ecma-builtins-internal.h"
3232

33-
/**
34-
* This object has a custom dispatch function.
35-
*/
36-
#define BUILTIN_CUSTOM_DISPATCH
37-
3833
/**
3934
* List of built-in routine identifiers.
4035
*/

jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.c

+21
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,27 @@
3434
* @{
3535
*/
3636

37+
/**
38+
* Dispatcher of the built-in's routines
39+
*
40+
* @return ecma value
41+
* Returned value must be freed with ecma_free_value.
42+
*/
43+
ecma_value_t
44+
ecma_builtin_async_generator_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
45+
ecma_value_t this_arg, /**< 'this' argument value */
46+
const ecma_value_t arguments_list_p[], /**< list of arguments
47+
* passed to routine */
48+
uint32_t arguments_number) /**< length of arguments' list */
49+
{
50+
JERRY_UNUSED (this_arg);
51+
JERRY_UNUSED (arguments_number);
52+
JERRY_UNUSED (arguments_list_p);
53+
JERRY_UNUSED (builtin_routine_id);
54+
55+
JERRY_UNREACHABLE ();
56+
} /* ecma_builtin_async_generator_dispatch_routine */
57+
3758
/**
3859
* @}
3960
* @}

0 commit comments

Comments
 (0)