Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit351d369

Browse files
Fixed the issue where gc was triggered during the attribute search process and a hashmap was recreated.
JerryScript-DCO-1.0-Signed-off-by: tangbin 2387440390@qq.com
1 parent5020015 commit351d369

File tree

5 files changed

+26
-1
lines changed

5 files changed

+26
-1
lines changed

‎jerry-core/ecma/base/ecma-gc.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
21092109
void
21102110
ecma_gc_run (void)
21112111
{
2112+
JERRY_CONTEXT(running_gc_count)++;
21122113
#if (JERRY_GC_MARK_LIMIT!=0)
21132114
JERRY_ASSERT (JERRY_CONTEXT (ecma_gc_mark_recursion_limit)==JERRY_GC_MARK_LIMIT);
21142115
#endif/* (JERRY_GC_MARK_LIMIT != 0) */
@@ -2235,6 +2236,7 @@ ecma_gc_run (void)
22352236
/* Free RegExp bytecodes stored in cache */
22362237
re_cache_gc ();
22372238
#endif/* JERRY_BUILTIN_REGEXP */
2239+
JERRY_CONTEXT(running_gc_count)--;
22382240
}/* ecma_gc_run */
22392241

22402242
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
729729
}
730730

731731
#ifJERRY_PROPERTY_HASHMAP
732-
if (steps >= (ECMA_PROPERTY_HASMAP_MINIMUM_SIZE /2))
732+
if (steps >= (ECMA_PROPERTY_HASMAP_MINIMUM_SIZE /2)&&JERRY_CONTEXT(running_gc_count)==0)
733733
{
734734
ecma_property_hashmap_create (obj_p);
735735
}

‎jerry-core/jcontext/jcontext.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ struct jerry_context_t
156156
jerry_external_string_free_cb_texternal_string_free_callback_p;/**< free callback for external strings */
157157
void*error_object_created_callback_user_p;/**< user pointer for error_object_update_callback_p */
158158
jerry_error_object_created_cb_terror_object_created_callback_p;/**< decorator callback for Error objects */
159+
uint32_trunning_gc_count;/**< The current status of gc */
159160
size_tecma_gc_objects_number;/**< number of currently allocated objects */
160161
size_tecma_gc_new_objects;/**< number of newly allocated objects since last GC session */
161162
size_tjmem_heap_allocated_size;/**< size of allocated regions */

‎jerry-core/jmem/jmem-heap.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ jmem_heap_init (void)
103103
JMEM_VALGRIND_NOACCESS_SPACE (JERRY_HEAP_CONTEXT (area),JMEM_HEAP_AREA_SIZE);
104104

105105
#endif/* !JERRY_SYSTEM_ALLOCATOR */
106+
JERRY_CONTEXT(running_gc_count)=0;
106107
JMEM_HEAP_STAT_INIT ();
107108
}/* jmem_heap_init */
108109

‎tests/jerry/gc-hashmap.js‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
vara=[];
16+
for(varv=0;v<256;v++){
17+
varn=Object.create(null);
18+
a.push(n,a);
19+
n=newWeakSet(a);
20+
n.o=1;
21+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp