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 */ 15 16function func(arg1 : number, arg2 : number) { 17 let a3 = 0; 18 let a1 = arg1 + arg2; 19 if (a1 > 0) { 20 a1 = a1 * 2; 21 } else { 22 a1++; 23 } 24 let a2 = arg1 * arg2; 25 if (a2 > 0) { 26 a2 = a2 / 2; 27 } else { 28 a2++; 29 } 30 a3 = a1 + a2; 31 return a3; 32} 33 34function Test() { 35 return func(8, 2); 36} 37 38Test(); 39ArkTools.jitCompileAsync(Test); 40let res = ArkTools.waitJitCompileFinish(Test); 41print(Test()); 42print(res); 43