Skip to content

Commit 79a2392

Browse files
authored
Remove template array flag from arrays after the collection is freed (#4500)
This patch fixes #4469. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
1 parent 90d206d commit 79a2392

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

jerry-core/ecma/base/ecma-helpers-collection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ ecma_collection_free_template_literal (ecma_collection_t *collection_p) /**< val
9696
ecma_extended_object_t *array_object_p = (ecma_extended_object_t *) object_p;
9797

9898
JERRY_ASSERT (array_object_p->u.array.length_prop_and_hole_count & ECMA_ARRAY_TEMPLATE_LITERAL);
99-
array_object_p->u.array.length_prop_and_hole_count &= (uint32_t) ECMA_ARRAY_TEMPLATE_LITERAL;
99+
array_object_p->u.array.length_prop_and_hole_count &= (uint32_t) ~ECMA_ARRAY_TEMPLATE_LITERAL;
100100

101101
ecma_property_value_t *property_value_p;
102102

@@ -108,7 +108,7 @@ ecma_collection_free_template_literal (ecma_collection_t *collection_p) /**< val
108108
array_object_p = (ecma_extended_object_t *) raw_object_p;
109109

110110
JERRY_ASSERT (array_object_p->u.array.length_prop_and_hole_count & ECMA_ARRAY_TEMPLATE_LITERAL);
111-
array_object_p->u.array.length_prop_and_hole_count &= (uint32_t) ECMA_ARRAY_TEMPLATE_LITERAL;
111+
array_object_p->u.array.length_prop_and_hole_count &= (uint32_t) ~ECMA_ARRAY_TEMPLATE_LITERAL;
112112

113113
ecma_deref_object (raw_object_p);
114114
ecma_deref_object (object_p);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
function assertArrayEquals(array1, array2) {
16+
if (array1.length !== array2.length) {
17+
return false;
18+
}
19+
20+
for (var i = 0; i < array1.length; i++) {
21+
if (array1[i] !== array2[i]) {
22+
return false;
23+
}
24+
}
25+
26+
return true;
27+
}
28+
29+
function tag(site){
30+
return site;
31+
}
32+
33+
var site1 = eval("tag`Cocoa`");
34+
var site3 = eval("tag`Cocoa`");
35+
36+
assertArrayEquals(site1, site3);

0 commit comments

Comments
 (0)