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 f(arg) { 17 let v = arg[0]; 18 let c = v.charCodeAt(0); 19 return v.length > 0 ? c : "."; 20} 21 22let ss = "abcdefg" 23for (let i = 0; i < 20; i++) { 24 f(ss) 25} 26 27ArkTools.jitCompileAsync(f); 28print(ArkTools.waitJitCompileFinish(f)) 29 30print(f(ss)) 31 32function f2() { 33 let v1 = 0, v18 = 0, v28 = 1; 34 for (; v28--;) { 35 ({ "length": v18, ...v1 } = "123456789"); 36 } 37 return [v18, v1]; 38} 39 40f2(); 41ArkTools.jitCompileAsync(f2); 42print(ArkTools.waitJitCompileFinish(f2)) 43 44print(f2()) 45