1/* 2 * Copyright (c) 2025 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 testBoolean() { 17 return new Boolean(); 18} 19function testNumber() { 20 return new Number(); 21} 22function testProxy() { 23 const handler = {}; 24 return new Proxy({}, handler); 25} 26function testDate() { 27 return new Date(); 28} 29function testArray() { 30 return new Array(); 31} 32function testSet() { 33 return new Set(); 34} 35function testMap() { 36 return new Map(); 37} 38function testObject() { 39 return new Object(); 40} 41function testError() { 42 return new Error(); 43} 44function testInt8Array() { 45 return new Int8Array(); 46} 47function testUint8Array() { 48 return new Uint8Array(); 49} 50function testUint8ClampedArray() { 51 return new Uint8ClampedArray(); 52} 53function testInt16Array() { 54 return new Int16Array(); 55} 56function testUint16Array() { 57 return new Uint16Array(); 58} 59function testInt32Array() { 60 return new Int32Array(); 61} 62function testUint32Array() { 63 return new Uint32Array(); 64} 65function testFloat32Array() { 66 return new Float32Array(); 67} 68function testFloat64Array() { 69 return new Float64Array(); 70} 71function testBigInt64Array() { 72 return new BigInt64Array(); 73} 74function testBigUint64Array() { 75 return new BigUint64Array(); 76} 77 78testBoolean(); 79testNumber(); 80testProxy(); 81testDate(); 82testArray(); 83testSet(); 84testMap(); 85testObject(); 86testError(); 87testInt8Array(); 88testUint8Array(); 89testUint8ClampedArray(); 90testInt16Array(); 91testUint16Array(); 92testInt32Array(); 93testUint32Array(); 94testFloat32Array(); 95testFloat64Array(); 96testBigInt64Array(); 97testBigUint64Array(); 98 99 100ArkTools.jitCompileAsync(testBoolean); 101ArkTools.jitCompileAsync(testNumber); 102ArkTools.jitCompileAsync(testProxy); 103ArkTools.jitCompileAsync(testDate); 104ArkTools.jitCompileAsync(testArray); 105ArkTools.jitCompileAsync(testSet); 106ArkTools.jitCompileAsync(testMap); 107ArkTools.jitCompileAsync(testObject); 108ArkTools.jitCompileAsync(testError); 109ArkTools.jitCompileAsync(testInt8Array); 110ArkTools.jitCompileAsync(testUint8Array); 111ArkTools.jitCompileAsync(testUint8ClampedArray); 112ArkTools.jitCompileAsync(testInt16Array); 113ArkTools.jitCompileAsync(testUint16Array); 114ArkTools.jitCompileAsync(testInt32Array); 115ArkTools.jitCompileAsync(testUint32Array); 116ArkTools.jitCompileAsync(testFloat32Array); 117ArkTools.jitCompileAsync(testFloat64Array); 118ArkTools.jitCompileAsync(testBigInt64Array); 119ArkTools.jitCompileAsync(testBigUint64Array); 120 121print(ArkTools.waitJitCompileFinish(testBoolean)); 122print(ArkTools.waitJitCompileFinish(testNumber)); 123print(ArkTools.waitJitCompileFinish(testProxy)); 124print(ArkTools.waitJitCompileFinish(testDate)); 125print(ArkTools.waitJitCompileFinish(testArray)); 126print(ArkTools.waitJitCompileFinish(testSet)); 127print(ArkTools.waitJitCompileFinish(testMap)); 128print(ArkTools.waitJitCompileFinish(testObject)); 129print(ArkTools.waitJitCompileFinish(testError)); 130print(ArkTools.waitJitCompileFinish(testInt8Array)); 131print(ArkTools.waitJitCompileFinish(testUint8Array)); 132print(ArkTools.waitJitCompileFinish(testUint8ClampedArray)); 133print(ArkTools.waitJitCompileFinish(testInt16Array)); 134print(ArkTools.waitJitCompileFinish(testUint16Array)); 135print(ArkTools.waitJitCompileFinish(testInt32Array)); 136print(ArkTools.waitJitCompileFinish(testUint32Array)); 137print(ArkTools.waitJitCompileFinish(testFloat32Array)); 138print(ArkTools.waitJitCompileFinish(testFloat64Array)); 139print(ArkTools.waitJitCompileFinish(testBigInt64Array)); 140print(ArkTools.waitJitCompileFinish(testBigUint64Array)); 141 142class C {}; 143Boolean = C; 144Number = C; 145Proxy = C; 146Date = C; 147Array = C; 148Set = C; 149Map = C; 150Object = C; 151Error = C; 152Int8Array = C; 153Uint8Array = C; 154Uint8ClampedArray = C; 155Int16Array = C; 156Uint16Array = C; 157Int32Array = C; 158Uint32Array = C; 159Float32Array = C; 160Float64Array = C; 161BigInt64Array = C; 162BigUint64Array = C; 163 164testBoolean(); 165testNumber(); 166testProxy(); 167testDate(); 168testArray(); 169testSet(); 170testMap(); 171testObject(); 172testError(); 173testInt8Array(); 174testUint8Array(); 175testUint8ClampedArray(); 176testInt16Array(); 177testUint16Array(); 178testInt32Array(); 179testUint32Array(); 180testFloat32Array(); 181testFloat64Array(); 182testBigInt64Array(); 183testBigUint64Array();