Removing ecma_builtin_*_get_routine_parameters_number routines.

This commit is contained in:
Ruben Ayrapetyan
2014-10-28 20:12:03 +03:00
parent 87310e43c6
commit f9e809e2e8
17 changed files with 233 additions and 658 deletions
@@ -175,16 +175,16 @@ ecma_builtin_array_try_to_instantiate_property (ecma_object_t *obj_p, /**< objec
switch (id) switch (id)
{ {
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: #define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: \
{ \
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_ARRAY, id, length); \
\
value = ecma_make_object_value (func_obj_p); \
\
break; \
}
ECMA_BUILTIN_ARRAY_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST) ECMA_BUILTIN_ARRAY_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST #undef CASE_ROUTINE_PROP_LIST
{
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_ARRAY, id);
value = ecma_make_object_value (func_obj_p);
break;
}
#define CASE_VALUE_PROP_LIST(name, value) case name: #define CASE_VALUE_PROP_LIST(name, value) case name:
ECMA_BUILTIN_ARRAY_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST) ECMA_BUILTIN_ARRAY_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST)
#undef CASE_VALUE_PROP_LIST #undef CASE_VALUE_PROP_LIST
@@ -264,28 +264,6 @@ ecma_builtin_array_dispatch_routine (ecma_magic_string_id_t builtin_routine_id,
} }
} /* ecma_builtin_array_dispatch_routine */ } /* ecma_builtin_array_dispatch_routine */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_array_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id) /**< built-in routine's
name */
{
switch (builtin_routine_id)
{
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: return length;
ECMA_BUILTIN_ARRAY_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_array_get_routine_parameters_number */
/** /**
* Handle calling [[Call]] of built-in Array object * Handle calling [[Call]] of built-in Array object
* *
@@ -164,17 +164,18 @@ ecma_builtin_array_prototype_try_to_instantiate_property (ecma_object_t *obj_p,
switch (id) switch (id)
{ {
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: #define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: \
{ \
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE, \
id, \
length); \
\
value = ecma_make_object_value (func_obj_p); \
\
break; \
}
ECMA_BUILTIN_ARRAY_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST) ECMA_BUILTIN_ARRAY_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST #undef CASE_ROUTINE_PROP_LIST
{
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE,
id);
value = ecma_make_object_value (func_obj_p);
break;
}
#define CASE_VALUE_PROP_LIST(name, value) case name: #define CASE_VALUE_PROP_LIST(name, value) case name:
ECMA_BUILTIN_ARRAY_PROTOTYPE_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST) ECMA_BUILTIN_ARRAY_PROTOTYPE_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST)
ECMA_BUILTIN_ARRAY_PROTOTYPE_OBJECT_NUMBER_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST) ECMA_BUILTIN_ARRAY_PROTOTYPE_OBJECT_NUMBER_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST)
@@ -272,29 +273,6 @@ ecma_builtin_array_prototype_dispatch_routine (ecma_magic_string_id_t builtin_ro
} }
} /* ecma_builtin_array_prototype_dispatch_routine */ } /* ecma_builtin_array_prototype_dispatch_routine */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_array_prototype_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id) /**< built-in
routine's
name */
{
switch (builtin_routine_id)
{
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: return length;
ECMA_BUILTIN_ARRAY_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_array_prototype_get_routine_parameters_number */
/** /**
* @} * @}
* @} * @}
@@ -205,19 +205,6 @@ ecma_builtin_boolean_dispatch_routine (ecma_magic_string_id_t builtin_routine_id
JERRY_UNREACHABLE (); JERRY_UNREACHABLE ();
} /* ecma_builtin_boolean_dispatch_routine */ } /* ecma_builtin_boolean_dispatch_routine */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_boolean_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id __unused) /**< built-in
routine's
name */
{
JERRY_UNREACHABLE ();
} /* ecma_builtin_boolean_get_routine_parameters_boolean */
/** /**
* Handle calling [[Call]] of built-in Boolean object * Handle calling [[Call]] of built-in Boolean object
* *
@@ -236,17 +236,18 @@ ecma_builtin_boolean_prototype_try_to_instantiate_property (ecma_object_t *obj_p
switch (id) switch (id)
{ {
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: #define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: \
{ \
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE, \
id, \
length); \
\
value = ecma_make_object_value (func_obj_p); \
\
break; \
}
ECMA_BUILTIN_BOOLEAN_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST) ECMA_BUILTIN_BOOLEAN_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST #undef CASE_ROUTINE_PROP_LIST
{
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE,
id);
value = ecma_make_object_value (func_obj_p);
break;
}
#define CASE_VALUE_PROP_LIST(name, value) case name: #define CASE_VALUE_PROP_LIST(name, value) case name:
ECMA_BUILTIN_BOOLEAN_PROTOTYPE_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST) ECMA_BUILTIN_BOOLEAN_PROTOTYPE_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST)
#undef CASE_VALUE_PROP_LIST #undef CASE_VALUE_PROP_LIST
@@ -334,29 +335,6 @@ ecma_builtin_boolean_prototype_dispatch_routine (ecma_magic_string_id_t builtin_
} }
} /* ecma_builtin_boolean_prototype_dispatch_routine */ } /* ecma_builtin_boolean_prototype_dispatch_routine */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_boolean_prototype_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id) /**< built-in
routine's
name */
{
switch (builtin_routine_id)
{
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: return length;
ECMA_BUILTIN_BOOLEAN_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_boolean_prototype_get_routine_parameters_number */
/** /**
* @} * @}
* @} * @}
@@ -75,17 +75,6 @@ ecma_builtin_compact_profile_error_dispatch_routine (ecma_magic_string_id_t buil
JERRY_UNREACHABLE (); JERRY_UNREACHABLE ();
} /* ecma_builtin_compact_profile_error_dispatch_routine */ } /* ecma_builtin_compact_profile_error_dispatch_routine */
/**
* Get compact_profile_error of routine's parameters
*
* @return compact_profile_error of parameters
*/
ecma_length_t
ecma_builtin_compact_profile_error_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id __unused)
{
JERRY_UNREACHABLE ();
} /* ecma_builtin_compact_profile_error_get_routine_parameters_compact_profile_error */
/** /**
* Handle calling [[Call]] of built-in CompactProfileError object * Handle calling [[Call]] of built-in CompactProfileError object
* *
@@ -204,19 +204,6 @@ ecma_builtin_function_dispatch_routine (ecma_magic_string_id_t builtin_routine_i
JERRY_UNREACHABLE (); JERRY_UNREACHABLE ();
} /* ecma_builtin_function_dispatch_routine */ } /* ecma_builtin_function_dispatch_routine */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_function_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id __unused) /**< built-in
routine's
name */
{
JERRY_UNREACHABLE ();
} /* ecma_builtin_function_get_routine_parameters_number */
/** /**
* Handle calling [[Call]] of built-in Function object * Handle calling [[Call]] of built-in Function object
* *
@@ -251,17 +251,18 @@ ecma_builtin_function_prototype_try_to_instantiate_property (ecma_object_t *obj_
switch (id) switch (id)
{ {
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: #define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: \
{ \
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, \
id, \
length); \
\
value = ecma_make_object_value (func_obj_p); \
\
break; \
}
ECMA_BUILTIN_FUNCTION_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST) ECMA_BUILTIN_FUNCTION_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST #undef CASE_ROUTINE_PROP_LIST
{
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
id);
value = ecma_make_object_value (func_obj_p);
break;
}
#define CASE_VALUE_PROP_LIST(name, value) case name: #define CASE_VALUE_PROP_LIST(name, value) case name:
ECMA_BUILTIN_FUNCTION_PROTOTYPE_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST) ECMA_BUILTIN_FUNCTION_PROTOTYPE_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST)
#undef CASE_VALUE_PROP_LIST #undef CASE_VALUE_PROP_LIST
@@ -350,29 +351,6 @@ ecma_builtin_function_prototype_dispatch_routine (ecma_magic_string_id_t builtin
} }
} /* ecma_builtin_function_prototype_dispatch_routine */ } /* ecma_builtin_function_prototype_dispatch_routine */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_function_prototype_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id) /**< built-in
routine's
name */
{
switch (builtin_routine_id)
{
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: return length;
ECMA_BUILTIN_FUNCTION_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_function_prototype_get_routine_parameters_number */
/** /**
* @} * @}
* @} * @}
+62 -114
View File
@@ -74,6 +74,44 @@ static const ecma_magic_string_id_t ecma_builtin_global_property_names[] =
#endif /* CONFIG_ECMA_COMPACT_PROFILE */ #endif /* CONFIG_ECMA_COMPACT_PROFILE */
}; };
#define ECMA_BUILTIN_GLOBAL_OBJECT_ROUTINES_PROPERTY_LIST(macro) \
macro (ECMA_MAGIC_STRING_EVAL, \
ecma_builtin_global_object_eval, \
1, \
1) \
macro (ECMA_MAGIC_STRING_PARSE_FLOAT, \
ecma_builtin_global_object_parse_float, \
1, \
1) \
macro (ECMA_MAGIC_STRING_IS_NAN, \
ecma_builtin_global_object_is_nan, \
1, \
1) \
macro (ECMA_MAGIC_STRING_IS_FINITE, \
ecma_builtin_global_object_is_finite, \
1, \
1) \
macro (ECMA_MAGIC_STRING_DECODE_URI, \
ecma_builtin_global_object_decode_uri, \
1, \
1) \
macro (ECMA_MAGIC_STRING_DECODE_URI_COMPONENT, \
ecma_builtin_global_object_decode_uri_component, \
1, \
1) \
macro (ECMA_MAGIC_STRING_ENCODE_URI, \
ecma_builtin_global_object_encode_uri, \
1, \
1) \
macro (ECMA_MAGIC_STRING_ENCODE_URI_COMPONENT, \
ecma_builtin_global_object_encode_uri_component, \
1, \
1) \
macro (ECMA_MAGIC_STRING_PARSE_INT, \
ecma_builtin_global_object_parse_int, \
2, \
2)
/** /**
* Number of the Global object's built-in properties * Number of the Global object's built-in properties
*/ */
@@ -244,41 +282,6 @@ ecma_builtin_global_object_encode_uri_component (ecma_value_t uri_component) /**
ECMA_BUILTIN_CP_UNIMPLEMENTED (uri_component); ECMA_BUILTIN_CP_UNIMPLEMENTED (uri_component);
} /* ecma_builtin_global_object_encode_uri_component */ } /* ecma_builtin_global_object_encode_uri_component */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_global_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id) /**< built-in routine's
name */
{
switch (builtin_routine_id)
{
case ECMA_MAGIC_STRING_EVAL:
case ECMA_MAGIC_STRING_PARSE_FLOAT:
case ECMA_MAGIC_STRING_IS_NAN:
case ECMA_MAGIC_STRING_IS_FINITE:
case ECMA_MAGIC_STRING_DECODE_URI:
case ECMA_MAGIC_STRING_DECODE_URI_COMPONENT:
case ECMA_MAGIC_STRING_ENCODE_URI:
case ECMA_MAGIC_STRING_ENCODE_URI_COMPONENT:
{
return 1;
}
case ECMA_MAGIC_STRING_PARSE_INT:
{
return 2;
}
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_global_get_routine_parameters_number */
/** /**
* Dispatcher of the Global object's built-in routines * Dispatcher of the Global object's built-in routines
* *
@@ -296,69 +299,18 @@ ecma_builtin_global_dispatch_routine (ecma_magic_string_id_t builtin_routine_id,
switch (builtin_routine_id) switch (builtin_routine_id)
{ {
case ECMA_MAGIC_STRING_EVAL: #define ROUTINE_ARG(n) (arguments_number >= n ? arguments_list[n - 1] : value_undefined)
{ #define ROUTINE_ARG_LIST_1 ROUTINE_ARG(1)
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined); #define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1, ROUTINE_ARG(2)
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) \
return ecma_builtin_global_object_eval (arg); case name: \
} { \
return c_function_name (ROUTINE_ARG_LIST_ ## args_number); \
case ECMA_MAGIC_STRING_PARSE_INT: }
{ ECMA_BUILTIN_GLOBAL_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
ecma_value_t arg1 = (arguments_number >= 1 ? arguments_list[0] : value_undefined); #undef CASE_ROUTINE_PROP_LIST
ecma_value_t arg2 = (arguments_number >= 2 ? arguments_list[1] : value_undefined); #undef ROUTINE_ARG_LIST_1
#undef ROUTINE_ARG_LIST_2
return ecma_builtin_global_object_parse_int (arg1, arg2);
}
case ECMA_MAGIC_STRING_PARSE_FLOAT:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_global_object_parse_float (arg);
}
case ECMA_MAGIC_STRING_IS_NAN:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_global_object_is_nan (arg);
}
case ECMA_MAGIC_STRING_IS_FINITE:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_global_object_is_finite (arg);
}
case ECMA_MAGIC_STRING_DECODE_URI:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_global_object_decode_uri (arg);
}
case ECMA_MAGIC_STRING_DECODE_URI_COMPONENT:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_global_object_decode_uri_component (arg);
}
case ECMA_MAGIC_STRING_ENCODE_URI:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_global_object_encode_uri (arg);
}
case ECMA_MAGIC_STRING_ENCODE_URI_COMPONENT:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_global_object_encode_uri_component (arg);
}
default: default:
{ {
@@ -428,23 +380,19 @@ ecma_builtin_global_try_to_instantiate_property (ecma_object_t *obj_p, /**< obje
switch (id) switch (id)
{ {
case ECMA_MAGIC_STRING_EVAL: #define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: \
case ECMA_MAGIC_STRING_PARSE_INT: { \
case ECMA_MAGIC_STRING_PARSE_FLOAT: ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_GLOBAL, \
case ECMA_MAGIC_STRING_IS_NAN: id, \
case ECMA_MAGIC_STRING_IS_FINITE: length); \
case ECMA_MAGIC_STRING_DECODE_URI: \
case ECMA_MAGIC_STRING_DECODE_URI_COMPONENT: value = ecma_make_object_value (func_obj_p); \
case ECMA_MAGIC_STRING_ENCODE_URI: \
case ECMA_MAGIC_STRING_ENCODE_URI_COMPONENT: break; \
{
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_GLOBAL,
id);
value = ecma_make_object_value (func_obj_p);
break;
} }
ECMA_BUILTIN_GLOBAL_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST
case ECMA_MAGIC_STRING_UNDEFINED: case ECMA_MAGIC_STRING_UNDEFINED:
{ {
value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED); value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
+8 -30
View File
@@ -1069,16 +1069,16 @@ ecma_builtin_math_try_to_instantiate_property (ecma_object_t *obj_p, /**< object
switch (id) switch (id)
{ {
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: #define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: \
{ \
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_MATH, id, length); \
\
value = ecma_make_object_value (func_obj_p); \
\
break; \
}
ECMA_BUILTIN_MATH_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST) ECMA_BUILTIN_MATH_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST #undef CASE_ROUTINE_PROP_LIST
{
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_MATH, id);
value = ecma_make_object_value (func_obj_p);
break;
}
#define CASE_VALUE_PROP_LIST(name, value) case name: #define CASE_VALUE_PROP_LIST(name, value) case name:
ECMA_BUILTIN_MATH_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST) ECMA_BUILTIN_MATH_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST)
#undef CASE_VALUE_PROP_LIST #undef CASE_VALUE_PROP_LIST
@@ -1169,28 +1169,6 @@ ecma_builtin_math_dispatch_routine (ecma_magic_string_id_t builtin_routine_id, /
} }
} /* ecma_builtin_math_dispatch_routine */ } /* ecma_builtin_math_dispatch_routine */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_math_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id) /**< built-in routine's
name */
{
switch (builtin_routine_id)
{
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: return length;
ECMA_BUILTIN_MATH_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_math_get_routine_parameters_number */
/** /**
* @} * @}
* @} * @}
@@ -210,19 +210,6 @@ ecma_builtin_number_dispatch_routine (ecma_magic_string_id_t builtin_routine_id
JERRY_UNREACHABLE (); JERRY_UNREACHABLE ();
} /* ecma_builtin_number_dispatch_routine */ } /* ecma_builtin_number_dispatch_routine */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_number_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id __unused) /**< built-in
routine's
name */
{
JERRY_UNREACHABLE ();
} /* ecma_builtin_number_get_routine_parameters_number */
/** /**
* Handle calling [[Call]] of built-in Number object * Handle calling [[Call]] of built-in Number object
* *
@@ -324,17 +324,18 @@ ecma_builtin_number_prototype_try_to_instantiate_property (ecma_object_t *obj_p,
switch (id) switch (id)
{ {
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: #define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: \
{ \
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, \
id, \
length); \
\
value = ecma_make_object_value (func_obj_p); \
\
break; \
}
ECMA_BUILTIN_NUMBER_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST) ECMA_BUILTIN_NUMBER_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST #undef CASE_ROUTINE_PROP_LIST
{
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE,
id);
value = ecma_make_object_value (func_obj_p);
break;
}
#define CASE_VALUE_PROP_LIST(name, value) case name: #define CASE_VALUE_PROP_LIST(name, value) case name:
ECMA_BUILTIN_NUMBER_PROTOTYPE_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST) ECMA_BUILTIN_NUMBER_PROTOTYPE_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST)
#undef CASE_VALUE_PROP_LIST #undef CASE_VALUE_PROP_LIST
@@ -423,29 +424,6 @@ ecma_builtin_number_prototype_dispatch_routine (ecma_magic_string_id_t builtin_r
} }
} /* ecma_builtin_number_prototype_dispatch_routine */ } /* ecma_builtin_number_prototype_dispatch_routine */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_number_prototype_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id) /**< built-in
routine's
name */
{
switch (builtin_routine_id)
{
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: return length;
ECMA_BUILTIN_NUMBER_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_number_prototype_get_routine_parameters_number */
/** /**
* @} * @}
* @} * @}
+80 -158
View File
@@ -60,6 +60,61 @@ static const ecma_magic_string_id_t ecma_builtin_object_property_names[] =
ECMA_MAGIC_STRING_KEYS ECMA_MAGIC_STRING_KEYS
}; };
#define ECMA_BUILTIN_OBJECT_OBJECT_ROUTINES_PROPERTY_LIST(macro) \
macro (ECMA_MAGIC_STRING_GET_PROTOTYPE_OF_UL, \
ecma_builtin_object_object_get_prototype_of, \
1, \
1) \
macro (ECMA_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL, \
ecma_builtin_object_object_get_own_property_names, \
1, \
1) \
macro (ECMA_MAGIC_STRING_SEAL, \
ecma_builtin_object_object_seal, \
1, \
1) \
macro (ECMA_MAGIC_STRING_FREEZE, \
ecma_builtin_object_object_freeze, \
1, \
1) \
macro (ECMA_MAGIC_STRING_PREVENT_EXTENSIONS_UL, \
ecma_builtin_object_object_prevent_extensions, \
1, \
1) \
macro (ECMA_MAGIC_STRING_IS_SEALED_UL, \
ecma_builtin_object_object_is_sealed, \
1, \
1) \
macro (ECMA_MAGIC_STRING_IS_FROZEN_UL, \
ecma_builtin_object_object_is_frozen, \
1, \
1) \
macro (ECMA_MAGIC_STRING_IS_EXTENSIBLE, \
ecma_builtin_object_object_is_extensible, \
1, \
1) \
macro (ECMA_MAGIC_STRING_KEYS, \
ecma_builtin_object_object_keys, \
1, \
1) \
macro (ECMA_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL, \
ecma_builtin_object_object_get_own_property_descriptor, \
2, \
2) \
macro (ECMA_MAGIC_STRING_CREATE, \
ecma_builtin_object_object_create, \
2, \
2) \
macro (ECMA_MAGIC_STRING_DEFINE_PROPERTIES_UL, \
ecma_builtin_object_object_define_properties, \
2, \
2) \
macro (ECMA_MAGIC_STRING_DEFINE_PROPERTY_UL, \
ecma_builtin_object_object_define_property, \
3, \
3) \
/** /**
* Number of the Object object's built-in properties * Number of the Object object's built-in properties
*/ */
@@ -67,49 +122,6 @@ static const ecma_length_t ecma_builtin_object_property_number = (sizeof (ecma_b
sizeof (ecma_magic_string_id_t)); sizeof (ecma_magic_string_id_t));
JERRY_STATIC_ASSERT (sizeof (ecma_builtin_object_property_names) > sizeof (void*)); JERRY_STATIC_ASSERT (sizeof (ecma_builtin_object_property_names) > sizeof (void*));
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_object_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id) /**< built-in routine's
name */
{
switch (builtin_routine_id)
{
case ECMA_MAGIC_STRING_GET_PROTOTYPE_OF_UL:
case ECMA_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL:
case ECMA_MAGIC_STRING_SEAL:
case ECMA_MAGIC_STRING_FREEZE:
case ECMA_MAGIC_STRING_PREVENT_EXTENSIONS_UL:
case ECMA_MAGIC_STRING_IS_SEALED_UL:
case ECMA_MAGIC_STRING_IS_FROZEN_UL:
case ECMA_MAGIC_STRING_IS_EXTENSIBLE:
case ECMA_MAGIC_STRING_KEYS:
{
return 1;
}
case ECMA_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL:
case ECMA_MAGIC_STRING_CREATE:
case ECMA_MAGIC_STRING_DEFINE_PROPERTIES_UL:
{
return 2;
}
case ECMA_MAGIC_STRING_DEFINE_PROPERTY_UL:
{
return 3;
}
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_object_get_routine_parameters_number */
/** /**
* Handle calling [[Call]] of built-in Object object * Handle calling [[Call]] of built-in Object object
* *
@@ -423,101 +435,20 @@ ecma_builtin_object_dispatch_routine (ecma_magic_string_id_t builtin_routine_id,
switch (builtin_routine_id) switch (builtin_routine_id)
{ {
case ECMA_MAGIC_STRING_GET_PROTOTYPE_OF_UL: #define ROUTINE_ARG(n) (arguments_number >= n ? arguments_list[n - 1] : value_undefined)
{ #define ROUTINE_ARG_LIST_1 ROUTINE_ARG(1)
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined); #define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1, ROUTINE_ARG(2)
#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2, ROUTINE_ARG(3)
return ecma_builtin_object_object_get_prototype_of (arg); #define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) \
} case name: \
{ \
case ECMA_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL: return c_function_name (ROUTINE_ARG_LIST_ ## args_number); \
{ }
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined); ECMA_BUILTIN_OBJECT_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST
return ecma_builtin_object_object_get_own_property_names (arg); #undef ROUTINE_ARG_LIST_1
} #undef ROUTINE_ARG_LIST_2
#undef ROUTINE_ARG_LIST_3
case ECMA_MAGIC_STRING_SEAL:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_object_object_seal (arg);
}
case ECMA_MAGIC_STRING_FREEZE:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_object_object_freeze (arg);
}
case ECMA_MAGIC_STRING_PREVENT_EXTENSIONS_UL:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_object_object_prevent_extensions (arg);
}
case ECMA_MAGIC_STRING_IS_SEALED_UL:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_object_object_is_sealed (arg);
}
case ECMA_MAGIC_STRING_IS_FROZEN_UL:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_object_object_is_frozen (arg);
}
case ECMA_MAGIC_STRING_IS_EXTENSIBLE:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_object_object_is_extensible (arg);
}
case ECMA_MAGIC_STRING_KEYS:
{
ecma_value_t arg = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
return ecma_builtin_object_object_keys (arg);
}
case ECMA_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL:
{
ecma_value_t arg1 = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
ecma_value_t arg2 = (arguments_number >= 2 ? arguments_list[1] : value_undefined);
return ecma_builtin_object_object_get_own_property_descriptor (arg1, arg2);
}
case ECMA_MAGIC_STRING_CREATE:
{
ecma_value_t arg1 = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
ecma_value_t arg2 = (arguments_number >= 2 ? arguments_list[1] : value_undefined);
return ecma_builtin_object_object_create (arg1, arg2);
}
case ECMA_MAGIC_STRING_DEFINE_PROPERTIES_UL:
{
ecma_value_t arg1 = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
ecma_value_t arg2 = (arguments_number >= 2 ? arguments_list[1] : value_undefined);
return ecma_builtin_object_object_define_properties (arg1, arg2);
}
case ECMA_MAGIC_STRING_DEFINE_PROPERTY_UL:
{
ecma_value_t arg1 = (arguments_number >= 1 ? arguments_list[0] : value_undefined);
ecma_value_t arg2 = (arguments_number >= 2 ? arguments_list[1] : value_undefined);
ecma_value_t arg3 = (arguments_number >= 3 ? arguments_list[2] : value_undefined);
return ecma_builtin_object_object_define_property (arg1, arg2, arg3);
}
default: default:
{ {
@@ -587,27 +518,18 @@ ecma_builtin_object_try_to_instantiate_property (ecma_object_t *obj_p, /**< obje
switch (id) switch (id)
{ {
case ECMA_MAGIC_STRING_GET_PROTOTYPE_OF_UL: #define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: \
case ECMA_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL: { \
case ECMA_MAGIC_STRING_SEAL: ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_OBJECT, \
case ECMA_MAGIC_STRING_FREEZE: id, \
case ECMA_MAGIC_STRING_PREVENT_EXTENSIONS_UL: length); \
case ECMA_MAGIC_STRING_IS_SEALED_UL: \
case ECMA_MAGIC_STRING_IS_FROZEN_UL: value = ecma_make_object_value (func_obj_p); \
case ECMA_MAGIC_STRING_IS_EXTENSIBLE: \
case ECMA_MAGIC_STRING_KEYS: break; \
case ECMA_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL:
case ECMA_MAGIC_STRING_CREATE:
case ECMA_MAGIC_STRING_DEFINE_PROPERTY_UL:
case ECMA_MAGIC_STRING_DEFINE_PROPERTIES_UL:
{
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_OBJECT,
id);
value = ecma_make_object_value (func_obj_p);
break;
} }
ECMA_BUILTIN_OBJECT_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST
case ECMA_MAGIC_STRING_PROTOTYPE: case ECMA_MAGIC_STRING_PROTOTYPE:
{ {
value = ecma_make_object_value (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE)); value = ecma_make_object_value (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE));
@@ -327,17 +327,18 @@ ecma_builtin_object_prototype_try_to_instantiate_property (ecma_object_t *obj_p,
switch (id) switch (id)
{ {
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: #define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: \
{ \
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, \
id, \
length); \
\
value = ecma_make_object_value (func_obj_p); \
\
break; \
}
ECMA_BUILTIN_OBJECT_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST) ECMA_BUILTIN_OBJECT_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST #undef CASE_ROUTINE_PROP_LIST
{
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
id);
value = ecma_make_object_value (func_obj_p);
break;
}
#define CASE_VALUE_PROP_LIST(name, value) case name: #define CASE_VALUE_PROP_LIST(name, value) case name:
ECMA_BUILTIN_OBJECT_PROTOTYPE_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST) ECMA_BUILTIN_OBJECT_PROTOTYPE_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST)
#undef CASE_VALUE_PROP_LIST #undef CASE_VALUE_PROP_LIST
@@ -426,29 +427,6 @@ ecma_builtin_object_prototype_dispatch_routine (ecma_magic_string_id_t builtin_r
} }
} /* ecma_builtin_object_prototype_dispatch_routine */ } /* ecma_builtin_object_prototype_dispatch_routine */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_object_prototype_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id) /**< built-in
routine's
name */
{
switch (builtin_routine_id)
{
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: return length;
ECMA_BUILTIN_OBJECT_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_object_prototype_get_routine_parameters_number */
/** /**
* @} * @}
* @} * @}
@@ -212,16 +212,16 @@ ecma_builtin_string_try_to_instantiate_property (ecma_object_t *obj_p, /**< obje
switch (id) switch (id)
{ {
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: #define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: \
{ \
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_STRING, id, length); \
\
value = ecma_make_object_value (func_obj_p); \
\
break; \
}
ECMA_BUILTIN_STRING_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST) ECMA_BUILTIN_STRING_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST #undef CASE_ROUTINE_PROP_LIST
{
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_STRING, id);
value = ecma_make_object_value (func_obj_p);
break;
}
#define CASE_VALUE_PROP_LIST(name, value) case name: #define CASE_VALUE_PROP_LIST(name, value) case name:
ECMA_BUILTIN_STRING_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST) ECMA_BUILTIN_STRING_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST)
#undef CASE_VALUE_PROP_LIST #undef CASE_VALUE_PROP_LIST
@@ -297,28 +297,6 @@ ecma_builtin_string_dispatch_routine (ecma_magic_string_id_t builtin_routine_id,
} }
} /* ecma_builtin_string_dispatch_routine */ } /* ecma_builtin_string_dispatch_routine */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_string_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id) /**< built-in routine's
name */
{
switch (builtin_routine_id)
{
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: return length;
ECMA_BUILTIN_STRING_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_string_get_routine_parameters_number */
/** /**
* Handle calling [[Call]] of built-in String object * Handle calling [[Call]] of built-in String object
* *
@@ -544,17 +544,18 @@ ecma_builtin_string_prototype_try_to_instantiate_property (ecma_object_t *obj_p,
switch (id) switch (id)
{ {
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: #define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: \
{ \
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_STRING_PROTOTYPE, \
id, \
length); \
\
value = ecma_make_object_value (func_obj_p); \
\
break; \
}
ECMA_BUILTIN_STRING_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST) ECMA_BUILTIN_STRING_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST #undef CASE_ROUTINE_PROP_LIST
{
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (ECMA_BUILTIN_ID_STRING_PROTOTYPE,
id);
value = ecma_make_object_value (func_obj_p);
break;
}
#define CASE_VALUE_PROP_LIST(name, value) case name: #define CASE_VALUE_PROP_LIST(name, value) case name:
ECMA_BUILTIN_STRING_PROTOTYPE_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST) ECMA_BUILTIN_STRING_PROTOTYPE_OBJECT_OBJECT_VALUES_PROPERTY_LIST (CASE_VALUE_PROP_LIST)
#undef CASE_VALUE_PROP_LIST #undef CASE_VALUE_PROP_LIST
@@ -643,29 +644,6 @@ ecma_builtin_string_prototype_dispatch_routine (ecma_magic_string_id_t builtin_r
} }
} /* ecma_builtin_string_prototype_dispatch_routine */ } /* ecma_builtin_string_prototype_dispatch_routine */
/**
* Get number of routine's parameters
*
* @return number of parameters
*/
ecma_length_t
ecma_builtin_string_prototype_get_routine_parameters_number (ecma_magic_string_id_t builtin_routine_id) /**< built-in
routine's
name */
{
switch (builtin_routine_id)
{
#define CASE_ROUTINE_PROP_LIST(name, c_function_name, args_number, length) case name: return length;
ECMA_BUILTIN_STRING_PROTOTYPE_OBJECT_ROUTINES_PROPERTY_LIST (CASE_ROUTINE_PROP_LIST)
#undef CASE_ROUTINE_PROP_LIST
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_string_prototype_get_routine_parameters_number */
/** /**
* @} * @}
* @} * @}
+2 -3
View File
@@ -48,7 +48,8 @@
/* ecma-builtins.c */ /* ecma-builtins.c */
extern ecma_object_t* extern ecma_object_t*
ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id,
ecma_magic_string_id_t routine_id); ecma_magic_string_id_t routine_id,
ecma_number_t length_prop_num_value);
extern int32_t extern int32_t
ecma_builtin_bin_search_for_magic_string_id_in_array (const ecma_magic_string_id_t ids[], ecma_builtin_bin_search_for_magic_string_id_in_array (const ecma_magic_string_id_t ids[],
ecma_length_t array_length, ecma_length_t array_length,
@@ -146,8 +147,6 @@ ecma_builtin_ ## lowercase_name ## _dispatch_call (ecma_value_t *arguments_list_
extern ecma_completion_value_t \ extern ecma_completion_value_t \
ecma_builtin_ ## lowercase_name ## _dispatch_construct (ecma_value_t *arguments_list_p, \ ecma_builtin_ ## lowercase_name ## _dispatch_construct (ecma_value_t *arguments_list_p, \
ecma_length_t arguments_list_len); \ ecma_length_t arguments_list_len); \
extern ecma_length_t \
ecma_builtin_ ## lowercase_name ## _get_routine_parameters_number (ecma_magic_string_id_t routine_id); \
extern ecma_completion_value_t \ extern ecma_completion_value_t \
ecma_builtin_ ## lowercase_name ## _dispatch_routine (ecma_magic_string_id_t builtin_routine_id, \ ecma_builtin_ ## lowercase_name ## _dispatch_routine (ecma_magic_string_id_t builtin_routine_id, \
ecma_value_t this_arg_value, \ ecma_value_t this_arg_value, \
+5 -51
View File
@@ -31,9 +31,6 @@
* @{ * @{
*/ */
static ecma_length_t
ecma_builtin_get_routine_parameters_number (ecma_builtin_id_t builtin_id,
ecma_magic_string_id_t routine_id);
static ecma_completion_value_t static ecma_completion_value_t
ecma_builtin_dispatch_routine (ecma_builtin_id_t builtin_object_id, ecma_builtin_dispatch_routine (ecma_builtin_id_t builtin_object_id,
ecma_magic_string_id_t builtin_routine_id, ecma_magic_string_id_t builtin_routine_id,
@@ -304,8 +301,11 @@ ecma_object_t*
ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**< identifier of built-in object ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**< identifier of built-in object
that initially contains property that initially contains property
with the routine */ with the routine */
ecma_magic_string_id_t routine_id) /**< name of the built-in ecma_magic_string_id_t routine_id, /**< name of the built-in
object's routine property */ object's routine property */
ecma_number_t length_prop_num_value) /**< ecma-number - value
of 'length' property
of function object to create */
{ {
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE); ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
@@ -339,7 +339,7 @@ ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**
ecma_deref_ecma_string (magic_string_length_p); ecma_deref_ecma_string (magic_string_length_p);
ecma_number_t* len_p = ecma_alloc_number (); ecma_number_t* len_p = ecma_alloc_number ();
*len_p = ecma_uint32_to_number (ecma_builtin_get_routine_parameters_number (builtin_id, routine_id)); *len_p = length_prop_num_value;
len_prop_p->u.named_data_property.value = ecma_make_number_value (len_p); len_prop_p->u.named_data_property.value = ecma_make_number_value (len_p);
@@ -501,52 +501,6 @@ ecma_builtin_dispatch_construct (ecma_object_t *obj_p, /**< built-in object */
JERRY_UNREACHABLE (); JERRY_UNREACHABLE ();
} /* ecma_builtin_dispatch_construct */ } /* ecma_builtin_dispatch_construct */
/**
* Get parameters number of the built-in routine
*
* @return number of parameters of the routine according to ECMA-262 v5 specification
*/
static ecma_length_t
ecma_builtin_get_routine_parameters_number (ecma_builtin_id_t builtin_id, /**< identifier of built-in object
that initially contains property
with the routine */
ecma_magic_string_id_t routine_id) /**< name of the built-in object's
routine property */
{
switch (builtin_id)
{
#define DISPATCH_GET_ROUTINE_PARAMETERS_NUMBER(builtin_id, \
object_type, \
object_class, \
object_prototype_builtin_id, \
lowercase_name) \
case ECMA_BUILTIN_ID_ ## builtin_id: \
{ \
return ecma_builtin_ ## lowercase_name ## _get_routine_parameters_number (routine_id); \
}
ECMA_BUILTIN_LIST (DISPATCH_GET_ROUTINE_PARAMETERS_NUMBER)
#undef DISPATCH_GET_ROUTINE_PARAMETERS_NUMBER
case ECMA_BUILTIN_ID__COUNT:
{
JERRY_UNREACHABLE ();
}
default:
{
#ifdef CONFIG_ECMA_COMPACT_PROFILE
JERRY_UNREACHABLE ();
#else /* CONFIG_ECMA_COMPACT_PROFILE */
JERRY_UNIMPLEMENTED ("The built-in is not implemented.");
#endif /* !CONFIG_ECMA_COMPACT_PROFILE */
}
}
JERRY_UNREACHABLE ();
} /* ecma_builtin_get_routine_parameters_number */
/** /**
* Dispatcher of built-in routines * Dispatcher of built-in routines
* *