@@ -59,10 +59,10 @@ opfunc_typeof (ecma_value_t left_value) /**< left value */
59
59
/**
60
60
* Update data property for object literals.
61
61
*/
62
- void
63
- opfunc_set_data_property (ecma_object_t * object_p , /**< object */
64
- ecma_string_t * prop_name_p , /**< data property name */
65
- ecma_value_t value ) /**< new value */
62
+ static void
63
+ opfunc_assing_data_property (ecma_object_t * object_p , /**< object */
64
+ ecma_string_t * prop_name_p , /**< data property name */
65
+ ecma_value_t value ) /**< new value */
66
66
{
67
67
JERRY_ASSERT (!ecma_op_object_is_fast_array (object_p ));
68
68
@@ -96,7 +96,7 @@ opfunc_set_data_property (ecma_object_t *object_p, /**< object */
96
96
}
97
97
98
98
ecma_named_data_property_assign_value (object_p , prop_value_p , value );
99
- } /* opfunc_set_data_property */
99
+ } /* opfunc_assing_data_property */
100
100
101
101
/**
102
102
* Update getter or setter for object literals.
@@ -320,17 +320,15 @@ opfunc_for_in (ecma_value_t iterable_value, /**< ideally an iterable value */
320
320
#if JERRY_ESNEXT
321
321
322
322
/**
323
- * 'VM_OC_APPEND_ARRAY ' opcode handler specialized for spread objects
323
+ * 'CBC_EXT_SPREAD_ARRAY_APPEND ' opcode handler specialized for spread objects
324
324
*
325
325
* @return ECMA_VALUE_ERROR - if the operation failed
326
326
* ECMA_VALUE_EMPTY, otherwise
327
327
*/
328
- static ecma_value_t JERRY_ATTR_NOINLINE
328
+ ecma_value_t JERRY_ATTR_NOINLINE
329
329
opfunc_append_to_spread_array (ecma_value_t * stack_top_p , /**< current stack top */
330
330
uint16_t values_length ) /**< number of elements to set */
331
331
{
332
- JERRY_ASSERT (!(values_length & OPFUNC_HAS_SPREAD_ELEMENT ));
333
-
334
332
ecma_object_t * array_obj_p = ecma_get_object_from_value (stack_top_p [-1 ]);
335
333
JERRY_ASSERT (ecma_get_object_type (array_obj_p ) == ECMA_OBJECT_TYPE_ARRAY );
336
334
@@ -501,23 +499,15 @@ opfunc_spread_arguments (ecma_value_t *stack_top_p, /**< pointer to the current
501
499
#endif /* JERRY_ESNEXT */
502
500
503
501
/**
504
- * 'VM_OC_APPEND_ARRAY ' opcode handler, for setting array object properties
502
+ * 'CBC_ARRAY_APPEND ' opcode handler, for setting array object properties
505
503
*
506
504
* @return ECMA_VALUE_ERROR - if the operation failed
507
505
* ECMA_VALUE_EMPTY, otherwise
508
506
*/
509
507
ecma_value_t JERRY_ATTR_NOINLINE
510
508
opfunc_append_array (ecma_value_t * stack_top_p , /**< current stack top */
511
- uint16_t values_length ) /**< number of elements to set
512
- * with potential OPFUNC_HAS_SPREAD_ELEMENT flag */
509
+ uint16_t values_length ) /**< number of elements to set */
513
510
{
514
- #if JERRY_ESNEXT
515
- if (values_length >= OPFUNC_HAS_SPREAD_ELEMENT )
516
- {
517
- return opfunc_append_to_spread_array (stack_top_p , (uint16_t ) (values_length & ~OPFUNC_HAS_SPREAD_ELEMENT ));
518
- }
519
- #endif /* JERRY_ESNEXT */
520
-
521
511
ecma_object_t * array_obj_p = ecma_get_object_from_value (stack_top_p [-1 ]);
522
512
JERRY_ASSERT (ecma_get_object_type (array_obj_p ) == ECMA_OBJECT_TYPE_ARRAY );
523
513
@@ -1158,8 +1148,8 @@ opfunc_add_computed_field (ecma_value_t class_object, /**< class object */
1158
1148
* @return - new external function ecma-object
1159
1149
*/
1160
1150
ecma_value_t
1161
- opfunc_create_implicit_class_constructor (uint8_t opcode , /**< current cbc opcode */
1162
- const ecma_compiled_code_t * bytecode_p ) /**< current byte code */
1151
+ opfunc_create_implicit_class_constructor (const ecma_compiled_code_t * bytecode_p , /**< current byte code */
1152
+ bool is_herigate ) /* true -if class heritage is present */
1163
1153
{
1164
1154
/* 8. */
1165
1155
ecma_value_t script_value = ((cbc_uint8_arguments_t * ) bytecode_p )-> script_value ;
@@ -1181,7 +1171,7 @@ opfunc_create_implicit_class_constructor (uint8_t opcode, /**< current cbc opcod
1181
1171
constructor_object_p -> u .constructor_function .flags = 0 ;
1182
1172
1183
1173
/* 10.a.i */
1184
- if (opcode == CBC_EXT_PUSH_IMPLICIT_CONSTRUCTOR_HERITAGE )
1174
+ if (is_herigate )
1185
1175
{
1186
1176
constructor_object_p -> u .constructor_function .flags |= ECMA_CONSTRUCTOR_FUNCTION_HAS_HERITAGE ;
1187
1177
}
@@ -1574,9 +1564,6 @@ opfunc_collect_private_properties (ecma_value_t constructor, ecma_value_t prop_n
1574
1564
1575
1565
if (opcode == CBC_EXT_COLLECT_PRIVATE_METHOD )
1576
1566
{
1577
- prop_name ^= value ;
1578
- value ^= prop_name ;
1579
- prop_name ^= value ;
1580
1567
kind = ECMA_PRIVATE_METHOD ;
1581
1568
}
1582
1569
else if (opcode == CBC_EXT_COLLECT_PRIVATE_GETTER )
@@ -1977,10 +1964,7 @@ opfunc_finalize_class (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
1977
1964
* ECMA_VALUE_EMPTY - otherwise
1978
1965
*/
1979
1966
ecma_value_t
1980
- opfunc_form_super_reference (ecma_value_t * * vm_stack_top_p , /**< current vm stack top */
1981
- vm_frame_ctx_t * frame_ctx_p , /**< frame context */
1982
- ecma_value_t prop_name , /**< property name to resolve */
1983
- uint8_t opcode ) /**< current cbc opcode */
1967
+ opfunc_resolve_super (vm_frame_ctx_t * frame_ctx_p ) /**< frame context */
1984
1968
{
1985
1969
ecma_environment_record_t * environment_record_p = ecma_op_get_environment_record (frame_ctx_p -> lex_env_p );
1986
1970
@@ -2001,112 +1985,8 @@ opfunc_form_super_reference (ecma_value_t **vm_stack_top_p, /**< current vm stac
2001
1985
return ECMA_VALUE_ERROR ;
2002
1986
}
2003
1987
2004
- ecma_value_t * stack_top_p = * vm_stack_top_p ;
2005
-
2006
- if (opcode >= CBC_EXT_SUPER_PROP_ASSIGNMENT_REFERENCE )
2007
- {
2008
- JERRY_ASSERT (opcode == CBC_EXT_SUPER_PROP_ASSIGNMENT_REFERENCE
2009
- || opcode == CBC_EXT_SUPER_PROP_LITERAL_ASSIGNMENT_REFERENCE );
2010
- * stack_top_p ++ = parent ;
2011
- * stack_top_p ++ = ecma_copy_value (prop_name );
2012
- * vm_stack_top_p = stack_top_p ;
2013
-
2014
- return ECMA_VALUE_EMPTY ;
2015
- }
2016
-
2017
- ecma_object_t * parent_p = ecma_get_object_from_value (parent );
2018
- ecma_string_t * prop_name_p = ecma_op_to_property_key (prop_name );
2019
-
2020
- if (prop_name_p == NULL )
2021
- {
2022
- ecma_deref_object (parent_p );
2023
- return ECMA_VALUE_ERROR ;
2024
- }
2025
-
2026
- ecma_value_t result = ecma_op_object_get_with_receiver (parent_p , prop_name_p , frame_ctx_p -> this_binding );
2027
- ecma_deref_ecma_string (prop_name_p );
2028
- ecma_deref_object (parent_p );
2029
-
2030
- if (ECMA_IS_VALUE_ERROR (result ))
2031
- {
2032
- return result ;
2033
- }
2034
-
2035
- if (opcode == CBC_EXT_SUPER_PROP_LITERAL_REFERENCE || opcode == CBC_EXT_SUPER_PROP_REFERENCE )
2036
- {
2037
- * stack_top_p ++ = ecma_copy_value (frame_ctx_p -> this_binding );
2038
- * stack_top_p ++ = ECMA_VALUE_UNDEFINED ;
2039
- }
2040
-
2041
- * stack_top_p ++ = result ;
2042
- * vm_stack_top_p = stack_top_p ;
2043
-
2044
- return ECMA_VALUE_EMPTY ;
2045
- } /* opfunc_form_super_reference */
2046
-
2047
- /**
2048
- * Assignment operation for SuperRefence base
2049
- *
2050
- * @return ECMA_VALUE_ERROR - if the operation fails
2051
- * ECMA_VALUE_EMPTY - otherwise
2052
- */
2053
- ecma_value_t
2054
- opfunc_assign_super_reference (ecma_value_t * * vm_stack_top_p , /**< vm stack top */
2055
- vm_frame_ctx_t * frame_ctx_p , /**< frame context */
2056
- uint32_t opcode_data ) /**< opcode data to store the result */
2057
- {
2058
- ecma_value_t * stack_top_p = * vm_stack_top_p ;
2059
-
2060
- ecma_value_t base_obj = ecma_op_to_object (stack_top_p [-3 ]);
2061
-
2062
- if (ECMA_IS_VALUE_ERROR (base_obj ))
2063
- {
2064
- return base_obj ;
2065
- }
2066
-
2067
- ecma_object_t * base_obj_p = ecma_get_object_from_value (base_obj );
2068
- ecma_string_t * prop_name_p = ecma_op_to_property_key (stack_top_p [-2 ]);
2069
-
2070
- if (prop_name_p == NULL )
2071
- {
2072
- ecma_deref_object (base_obj_p );
2073
- return ECMA_VALUE_ERROR ;
2074
- }
2075
-
2076
- bool is_strict = (frame_ctx_p -> status_flags & VM_FRAME_CTX_IS_STRICT ) != 0 ;
2077
-
2078
- ecma_value_t result =
2079
- ecma_op_object_put_with_receiver (base_obj_p , prop_name_p , stack_top_p [-1 ], frame_ctx_p -> this_binding , is_strict );
2080
-
2081
- ecma_deref_ecma_string (prop_name_p );
2082
- ecma_deref_object (base_obj_p );
2083
-
2084
- if (ECMA_IS_VALUE_ERROR (result ))
2085
- {
2086
- return result ;
2087
- }
2088
-
2089
- for (int32_t i = 1 ; i <= 3 ; i ++ )
2090
- {
2091
- ecma_free_value (stack_top_p [- i ]);
2092
- }
2093
-
2094
- stack_top_p -= 3 ;
2095
-
2096
- if (opcode_data & VM_OC_PUT_STACK )
2097
- {
2098
- * stack_top_p ++ = result ;
2099
- }
2100
- else if (opcode_data & VM_OC_PUT_BLOCK )
2101
- {
2102
- ecma_fast_free_value (VM_GET_REGISTER (frame_ctx_p , 0 ));
2103
- VM_GET_REGISTERS (frame_ctx_p )[0 ] = result ;
2104
- }
2105
-
2106
- * vm_stack_top_p = stack_top_p ;
2107
-
2108
- return result ;
2109
- } /* opfunc_assign_super_reference */
1988
+ return parent ;
1989
+ } /* opfunc_resolve_super */
2110
1990
2111
1991
/**
2112
1992
* Copy data properties of an object
@@ -2222,7 +2102,7 @@ opfunc_copy_data_properties (ecma_value_t target_object, /**< target object */
2222
2102
}
2223
2103
}
2224
2104
2225
- opfunc_set_data_property (target_object_p , property_name_p , result );
2105
+ opfunc_assing_data_property (target_object_p , property_name_p , result );
2226
2106
ecma_free_value (result );
2227
2107
2228
2108
result = ECMA_VALUE_EMPTY ;
@@ -2303,8 +2183,82 @@ opfunc_lexical_scope_has_restricted_binding (vm_frame_ctx_t *frame_ctx_p, /**< f
2303
2183
&& !ecma_is_property_configurable (property ));
2304
2184
} /* opfunc_lexical_scope_has_restricted_binding */
2305
2185
2186
+ /**
2187
+ * Create function name property to the given function object
2188
+ */
2189
+ void
2190
+ opfunc_set_function_name (ecma_value_t function_object , /**< function object */
2191
+ ecma_value_t function_name , /**< function name */
2192
+ char * prefix_p , /**< function name prefix */
2193
+ lit_utf8_size_t prefix_size ) /**< function name prefix's length */
2194
+ {
2195
+ ecma_object_t * func_obj_p = ecma_get_object_from_value (function_object );
2196
+
2197
+ if (ecma_find_named_property (func_obj_p , ecma_get_magic_string (LIT_MAGIC_STRING_NAME )) != NULL )
2198
+ {
2199
+ return ;
2200
+ }
2201
+
2202
+ ecma_property_value_t * value_p ;
2203
+ value_p = ecma_create_named_data_property (func_obj_p ,
2204
+ ecma_get_magic_string (LIT_MAGIC_STRING_NAME ),
2205
+ ECMA_PROPERTY_FLAG_CONFIGURABLE ,
2206
+ NULL );
2207
+
2208
+ if (ecma_get_object_type (func_obj_p ) == ECMA_OBJECT_TYPE_FUNCTION )
2209
+ {
2210
+ ECMA_SET_SECOND_BIT_TO_POINTER_TAG (((ecma_extended_object_t * ) func_obj_p )-> u .function .scope_cp );
2211
+ }
2212
+
2213
+ value_p -> value = ecma_op_function_form_name (ecma_get_prop_name_from_value (function_name ), prefix_p , prefix_size );
2214
+ } /* opfunc_set_function_name */
2215
+
2306
2216
#endif /* JERRY_ESNEXT */
2307
2217
2218
+ /**
2219
+ * Set data property to an object/class
2220
+ *
2221
+ * @return ECMA_VALUE_ERROR - if the operation fails
2222
+ * ECMA_VALUE_EMPTY - otherwise
2223
+ */
2224
+ ecma_value_t
2225
+ opfunc_set_data_property (ecma_value_t * stack_top_p , /**< vm stack */
2226
+ ecma_value_t prop_name , /**< property name to set */
2227
+ ecma_value_t value , /**< value to set */
2228
+ bool is_static ) /**< true - if set class property
2229
+ false - otherwise */
2230
+ {
2231
+ ecma_string_t * prop_name_p = ecma_op_to_property_key (prop_name );
2232
+
2233
+ if (JERRY_UNLIKELY (prop_name_p == NULL ))
2234
+ {
2235
+ return ECMA_VALUE_ERROR ;
2236
+ }
2237
+
2238
+ int index = -1 ;
2239
+
2240
+ #if JERRY_ESNEXT
2241
+ if (JERRY_UNLIKELY (is_static ))
2242
+ {
2243
+ if (ecma_compare_ecma_string_to_magic_id (prop_name_p , LIT_MAGIC_STRING_PROTOTYPE ))
2244
+ {
2245
+ return ecma_raise_type_error (ECMA_ERR_CLASS_IS_NON_CONFIGURABLE );
2246
+ }
2247
+
2248
+ index -- ;
2249
+ }
2250
+ #else /* !JERRY_ESNEXT */
2251
+ JERRY_UNUSED (is_static );
2252
+ #endif /* JERRY_ESNEXT */
2253
+
2254
+ ecma_object_t * object_p = ecma_get_object_from_value (stack_top_p [index ]);
2255
+
2256
+ opfunc_assing_data_property (object_p , prop_name_p , value );
2257
+ ecma_deref_ecma_string (prop_name_p );
2258
+
2259
+ return ECMA_VALUE_EMPTY ;
2260
+ } /* opfunc_set_data_property */
2261
+
2308
2262
/**
2309
2263
* @}
2310
2264
* @}
0 commit comments