1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 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 */ 15let catchcnt = 0; 16function ThrowFunc() { 17 try { 18 throw new Error("error"); 19 } catch (e) { 20 catchcnt++; 21 } 22} 23 24function CallThrowFunc() { 25 ThrowFunc(); 26 let arr = []; 27 for(var i = 0; i < 10; i++){ 28 arr.push('CallThrowFunc') 29 } 30 for(var i = 0; i < 10; i++){ 31 arr.push('push............') 32 } 33 ThrowFunc(); 34} 35 36function Test() { 37 CallThrowFunc(); 38} 39 40for (let i = 0; i < 10; i++) { 41 Test(); 42} 43ArkTools.jitCompileAsync(Test); 44 45var ret = ArkTools.waitJitCompileFinish(Test); 46for (let i = 0; i < 20; i++) { 47 Test(); 48 ArkTools.gc(0); 49} 50 51print(catchcnt); 52