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