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 len:number = 1; 23 24// Check without params 25len = Math.sin(); 26//aot: [trace] aot inline builtin: Math.sin, caller function name:func_main_0@builtinMathSin 27print(len); //: NaN 28 29// Check with single param 30len = Math.sin(0); 31//aot: [trace] aot inline builtin: Math.sin, caller function name:func_main_0@builtinMathSin 32print(len); //: 0 33 34// Check with single not zero param 35len = Math.sin(Math.PI / 2); 36//aot: [trace] aot inline builtin: Math.sin, caller function name:func_main_0@builtinMathSin 37print(len); //: 1 38 39// Check with 2 params 40len = Math.sin(0,0); 41//aot: [trace] aot inline builtin: Math.sin, caller function name:func_main_0@builtinMathSin 42print(len); //: 0 43 44// Check with 3 params 45len = Math.sin(0,0,0); 46//aot: [trace] aot inline builtin: Math.sin, caller function name:func_main_0@builtinMathSin 47print(len); //: 0 48 49// Check with 4 params 50len = Math.sin(0,0,0,0); 51//aot: [trace] aot inline builtin: Math.sin, caller function name:func_main_0@builtinMathSin 52print(len); //: 0 53 54// Check with 5 params 55len = Math.sin(0,0,0,0,0); 56//aot: [trace] aot inline builtin: Math.sin, caller function name:func_main_0@builtinMathSin 57print(len); //: 0 58 59// Replace standart builtin 60let true_sin = Math.sin 61Math.sin = replace 62len = Math.sin(111); 63print(len); //: 111 64 65// Call standart builtin with non-number param 66Math.sin = true_sin 67//aot: [trace] aot inline builtin: Math.sin, caller function name:func_main_0@builtinMathSin 68//aot: [trace] Check Type: NotNumber1 69len = Math.sin("0"); // deopt 70print(len); //: 0 71