File tree Expand file tree Collapse file tree 2 files changed +22
-19
lines changed
jerry-core/ecma/operations Expand file tree Collapse file tree 2 files changed +22
-19
lines changed Original file line number Diff line number Diff line change @@ -210,32 +210,14 @@ ecma_object_t *
210
210
ecma_op_regexp_alloc (ecma_object_t * ctr_obj_p ) /**< constructor object pointer */
211
211
{
212
212
#if ENABLED (JERRY_ES2015 )
213
- bool default_alloc = false;
214
-
215
213
if (ctr_obj_p == NULL )
216
214
{
217
- ecma_object_t * re_prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE );
218
-
219
- ecma_value_t ctr_value = ecma_op_object_get_by_magic_id (re_prototype_obj_p , LIT_MAGIC_STRING_CONSTRUCTOR );
220
-
221
- if (ECMA_IS_VALUE_ERROR (ctr_value ))
222
- {
223
- return NULL ;
224
- }
225
-
226
- ctr_obj_p = ecma_get_object_from_value (ctr_value );
227
-
228
- default_alloc = true;
215
+ ctr_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP );
229
216
}
230
217
231
218
ecma_object_t * proto_obj_p = ecma_op_get_prototype_from_constructor (ctr_obj_p ,
232
219
ECMA_BUILTIN_ID_REGEXP_PROTOTYPE );
233
220
234
- if (default_alloc )
235
- {
236
- ecma_deref_object (ctr_obj_p );
237
- }
238
-
239
221
if (JERRY_UNLIKELY (proto_obj_p == NULL ))
240
222
{
241
223
return proto_obj_p ;
Original file line number Diff line number Diff line change
1
+ // Copyright JS Foundation and other contributors, http://js.foundation
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ RegExp . prototype . constructor = ""
16
+ var r = / a / ;
17
+ assert ( r . test ( "a" ) ) ;
18
+
19
+ RegExp . prototype . constructor = { }
20
+ r = / b / ;
21
+ assert ( r . test ( "b" ) ) ;
You can’t perform that action at this time.
0 commit comments