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 16declare function print(arg:any):string; 17function replace(a : number) 18{ 19 return a; 20} 21 22let res:number = 0; 23 24// Check without params 25res = Math.log10(); 26//aot: [trace] aot inline builtin: Math.log10, caller function name:func_main_0@builtinMathLog10 27print(res); //: NaN 28 29// Check with single param 30res = Math.log10(-0); 31//aot: [trace] aot inline builtin: Math.log10, caller function name:func_main_0@builtinMathLog10 32print(res); //: -Infinity 33 34res = Math.log10(+0); 35//aot: [trace] aot inline builtin: Math.log10, caller function name:func_main_0@builtinMathLog10 36print(res); //: -Infinity 37 38res = Math.log10(-123); 39//aot: [trace] aot inline builtin: Math.log10, caller function name:func_main_0@builtinMathLog10 40print(res); //: NaN 41 42res = Math.log10(10); 43//aot: [trace] aot inline builtin: Math.log10, caller function name:func_main_0@builtinMathLog10 44print(res); //: 1 45 46// Check with 2 params 47res = Math.log10(10, 10); 48//aot: [trace] aot inline builtin: Math.log10, caller function name:func_main_0@builtinMathLog10 49print(res); //: 1 50 51// Check with 3 params 52res = Math.log10(10, 10, 10); 53//aot: [trace] aot inline builtin: Math.log10, caller function name:func_main_0@builtinMathLog10 54print(res); //: 1 55 56// Check with 4 params 57res = Math.log10(10, 10, 10, 10); 58//aot: [trace] aot inline builtin: Math.log10, caller function name:func_main_0@builtinMathLog10 59print(res); //: 1 60 61// Check with 5 params 62res = Math.log10(10, 10, 10, 10, 10); 63//aot: [trace] aot inline builtin: Math.log10, caller function name:func_main_0@builtinMathLog10 64print(res); //: 1 65 66try { 67 //aot: [trace] aot inline builtin: Math.log10, caller function name:func_main_0@builtinMathLog10 68 print(Math.log10(10)); //: 1 69} catch(e) {} 70 71// Replace standart builtin 72let true_log10 = Math.log10 73Math.log10 = replace 74res = Math.log10(111); 75print(res); //: 111 76 77// Call standart builtin with non-number param 78Math.log10 = true_log10 79//aot: [trace] aot inline builtin: Math.log10, caller function name:func_main_0@builtinMathLog10 80//aot: [trace] Check Type: NotNumber1 81res = Math.log10("-0"); // deopt 82print(res); //: -Infinity 83