Reorder list of function built-in properties (#4791)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-10-07 09:52:07 +02:00
committed by GitHub
parent d98ff6fd30
commit 7c21fb89b2
2 changed files with 9 additions and 18 deletions
@@ -2173,19 +2173,6 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio
const ecma_compiled_code_t *bytecode_data_p; const ecma_compiled_code_t *bytecode_data_p;
bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p); bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);
#if JERRY_ESNEXT
bool append_prototype = CBC_FUNCTION_HAS_PROTOTYPE (bytecode_data_p->status_flags);
#else /* !JERRY_ESNEXT */
bool append_prototype = true;
#endif /* JERRY_ESNEXT */
if (append_prototype)
{
/* 'prototype' property is non-enumerable (ECMA-262 v5, 13.2.18) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_PROTOTYPE));
prop_counter_p->string_named_props++;
}
#if JERRY_ESNEXT #if JERRY_ESNEXT
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p; ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
@@ -2210,7 +2197,7 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio
#endif /* JERRY_ESNEXT */ #endif /* JERRY_ESNEXT */
#if JERRY_ESNEXT #if JERRY_ESNEXT
if (!append_prototype) if (!CBC_FUNCTION_HAS_PROTOTYPE (bytecode_data_p->status_flags))
{ {
return; return;
} }
@@ -2222,14 +2209,18 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio
if (append_caller_and_arguments) if (append_caller_and_arguments)
{ {
/* 'caller' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLER));
/* 'arguments' property is non-enumerable (ECMA-262 v5, 13.2.5) */ /* 'arguments' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_ARGUMENTS)); ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_ARGUMENTS));
/* 'caller' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLER));
prop_counter_p->string_named_props += 2; prop_counter_p->string_named_props += 2;
} }
/* 'prototype' property is non-enumerable (ECMA-262 v5, 13.2.18) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_PROTOTYPE));
prop_counter_p->string_named_props++;
} /* ecma_op_function_list_lazy_property_names */ } /* ecma_op_function_list_lazy_property_names */
/** /**
+1 -1
View File
@@ -46,7 +46,7 @@ Object.setPrototypeOf(print, prototype_obj);
assert(getProperties(print) == "dummy length caller arguments"); assert(getProperties(print) == "dummy length caller arguments");
function f1() {} function f1() {}
assert(Reflect.ownKeys(f1).toString() === "prototype,length,name,caller,arguments") assert(Reflect.ownKeys(f1).toString() === "length,name,arguments,caller,prototype")
async function f2() {} async function f2() {}
assert(Reflect.ownKeys(f2).toString() === "length,name") assert(Reflect.ownKeys(f2).toString() === "length,name")