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 16// enable ic 17var a = 0 18for (var i = 0; i < 10000; i++) { 19 a = a + a; 20} 21 22// case 1 23// test toString in holder. 24function t() {} 25var I = t.prototype 26I.toInt = function() {} 27I.toNumber = function() {} 28I.toString = function() {} 29print(Object.getOwnPropertyDescriptor(I, 'toString').enumerable) 30 31const o6 = { 32 ..."function", 33} 34print(Object.getOwnPropertyDescriptor(o6, 0).configurable) 35 36try { 37 const v2 = ("string").match(ArrayBuffer) 38 class C4 extends Array { 39 constructor(a6, a7) { 40 super() 41 try { 42 this.concat(ArrayBuffer, v2, ArrayBuffer); 43 return v2 44 } catch (e) {} 45 } 46 } 47 new C4(C4, C4); 48} catch(e) {} 49 50let arr = new Int8Array(10) 51for (let v5 =0; v5 < 400;v5++) { 52} 53Object.defineProperty(arr,"a", { 54 set(x) { 55 Reflect.deleteProperty(arr , "b") 56 return "a"; 57 } 58}) 59arr["b"] = "b" 60for (let i = 0; i < 1; ++i) { 61 arr["a"] = 1; 62 print(arr["a"]) 63} 64 65let obj = { 66 get a() { 67 Reflect.deleteProperty(this, "b") 68 print("get") 69 return "a"; 70 }, 71 b:"b" 72} 73 74for (let v5 =0;v5 < 400; v5++) { 75} 76 77for (let i = 0; i <2; i++) { 78 obj["a"] 79} 80 81let arr2 = {} 82for (let v5 =0; v5 < 400;v5++) { 83 84} 85Object.defineProperty(arr2,"a", { 86 set(x) { 87 Reflect.deleteProperty(this , "b") 88 return "a"; 89 } 90}) 91arr2["b"] = "b" 92 93for(let i = 0; i <i ;++i) { 94 arr2["a"] = 1; 95} 96print(arr2["a"]) 97 98let v1 = 0; 99class c0 { 100 set y(v3) {} 101} 102 103class c1 extends c0 { 104 set y(v4) { 105 if (v1++ === 29) { 106 delete c1.prototype.y; 107 } 108 } 109} 110 111class c2 extends c1 {} 112let v2 = new c2(); 113for (let v5 = 0;v5 < 2; v5++) { 114 print(v5); 115 v2.y = 42; 116} 117 118function fun1(n) { 119 function fun2(o) { 120 return o.a; 121 } 122 let obj = {a: 1}; 123 for (let i = 0; i < n; i++) { 124 fun2(obj); 125 } 126 return fun2(obj); 127} 128 129print(fun1(100)); 130print(fun1(1)); 131 132const v0 = [4.0, 3.0, -1.7976931348623157e+308, 1000000000.0]; 133const v3 = { __proto__: v0 }; 134const v4 = { __proto__: v3 }; 135v4[3] = v4; 136v0[1] = v0; 137v3.splice(0, 0); 138print(v3.length);