• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(str:any):string;
17//for Store Accessor ic miss, shouldn't update op
18class C {
19    constructor() {
20        this.x = 1;
21        this.y = 1;
22        this.z = 1;
23        this.w = 1;
24        this.t = 1;
25    }
26
27    set u(value) {
28        Object.defineProperty(this, "u", {
29            set () {}
30        })
31    }
32}
33
34function foo(obj) {
35    obj.u = 123;
36}
37
38let c1 = new C();
39let c2 = new C();
40foo(c1);
41foo(c2);
42print("test accessor ic successful1!");
43
44//for Store Accessor ic miss, if change to DictionaryMode, SetAsMega
45const v1 = new BigInt64Array();
46const o5 = {
47    set d(a4) {
48        Object.defineProperty(this, 2, {writable: true, value: 5});
49    },
50};
51o5.d = v1;
52print("test accessor ic successful2!");
53
54// ic hint wrong object
55var o3 = {
56    set d(a4) {
57        print("set proto")
58        Object.defineProperty(o2,"d",{
59            writable: true,
60            value:1
61        })
62    },
63    x:123
64};
65
66var o2 = {
67    __proto__:o3,
68    y:234
69}
70var o1 = {
71    __proto__:o2,
72    z:345
73}
74for(let i=0;i<5;i++){
75    o1.d = v1;
76}