diff --git a/tests/runtime/common/gc/CMakeLists.txt b/tests/runtime/common/gc/CMakeLists.txt index f8b6bb2548e09b540d2321ff8450aa9238284863..1233ac13fa3f70a4deafcde8afd8c7335fc3c633 100644 --- a/tests/runtime/common/gc/CMakeLists.txt +++ b/tests/runtime/common/gc/CMakeLists.txt @@ -58,3 +58,4 @@ panda_add_ecma_gc_test(FILE spaceTypeTest.js OPTIONS "--compiler-enable-jit=fals panda_add_ecma_gc_test(FILE concurrent.js OPTIONS "--compiler-enable-jit=false" "--gc-type=g1-gc" "--gc-trigger-type=debug-never") panda_add_ecma_gc_test(FILE hclass_changing_during_concurrent.js OPTIONS "--compiler-enable-jit=false" "--gc-type=g1-gc" "--gc-trigger-type=debug-never" "--heap-verifier=fail_on_verification:post") panda_add_ecma_gc_test(FILE pinObject.js OPTIONS "--compiler-enable-jit=false" "--gc-type=g1-gc" "--gc-trigger-type=debug-never") +panda_add_ecma_gc_test(FILE object_header_check_in_prewrite_barrier.js OPTIONS "--compiler-enable-jit=false" "--gc-type=g1-gc" "--gc-trigger-type=debug-never") diff --git a/tests/runtime/common/gc/object_header_check_in_prewrite_barrier.js b/tests/runtime/common/gc/object_header_check_in_prewrite_barrier.js new file mode 100644 index 0000000000000000000000000000000000000000..0bf57e5d8c5238b53536de9aa765ddce182585e2 --- /dev/null +++ b/tests/runtime/common/gc/object_header_check_in_prewrite_barrier.js @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Test object's property change from primitive type to object ref + * during GC in order to check pre-write barrier behavior in this case + */ + +let holder = new Object(); +let obj2 = new Array(5).fill('aabbcc'); +holder.prop = 42; +let gc = startGC("threshold", function(marker) { + holder.prop = obj2; +}); +waitForFinishGC(gc);