1/* 2 * Copyright (c) 2023 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 16declare var ArkTools:any; 17for (let i = 0; i < 10; ++i) { 18 Math; 19} 20ArkTools.printTypedOpProfiler("LOAD_BUILTIN_OBJECT"); 21ArkTools.printTypedOpProfiler("LOAD_PROPERTY"); 22ArkTools.clearTypedOpProfiler(); 23 24for (let i = 0; i < 1; ++i) { 25 for (let j = 0; j < 10; ++j) { 26 Math; 27 } 28} 29ArkTools.printTypedOpProfiler("LOAD_BUILTIN_OBJECT"); 30ArkTools.printTypedOpProfiler("LOAD_PROPERTY"); 31ArkTools.clearTypedOpProfiler(); 32 33for (let i = 0; i < 10; ++i) { 34 Math.sqrt; 35} 36ArkTools.printTypedOpProfiler("LOAD_BUILTIN_OBJECT"); 37ArkTools.printTypedOpProfiler("LOAD_PROPERTY"); 38ArkTools.clearTypedOpProfiler(); 39 40for (let i = 0; i < 1; ++i) { 41 for (let j = 0; j < 10; ++j) { 42 Math.sqrt; 43 } 44} 45ArkTools.printTypedOpProfiler("LOAD_BUILTIN_OBJECT"); 46ArkTools.printTypedOpProfiler("LOAD_PROPERTY"); 47ArkTools.clearTypedOpProfiler(); 48 49for (let i = 0; i < 10; ++i) { 50 Math.sqrt(4); 51} 52ArkTools.printTypedOpProfiler("LOAD_BUILTIN_OBJECT"); 53ArkTools.printTypedOpProfiler("LOAD_PROPERTY"); 54ArkTools.clearTypedOpProfiler(); 55 56for (let i = 0; i < 1; ++i) { 57 for (let j = 0; j < 10; ++j) { 58 Math.sqrt(4); 59 } 60} 61ArkTools.printTypedOpProfiler("LOAD_BUILTIN_OBJECT"); 62ArkTools.printTypedOpProfiler("LOAD_PROPERTY"); 63ArkTools.clearTypedOpProfiler(); 64