• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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/*
17 * @tc.name:loadicbyvalue
18 * @tc.desc:test loadicbyvalue
19 * @tc.type: FUNC
20 * @tc.require: issueI5NO8G
21 */
22var i = 3;
23var obj = {3:"icsuccess"};
24function func1(a)
25{
26    var b = a[i];
27}
28for (let j = 300; j > 0; j--)
29{
30    func1(obj);
31}
32print(obj[i]);
33
34// PoC testcase
35const arr = []
36for (let i = 0; i < 20; i ++) {
37    const v0 = "p" + i;
38    const v1 = Symbol.iterator;
39    const v2 = {
40        [v1]() {},
41    };
42    arr[v0] = i;
43}
44const v3 = new Uint8Array(128);
45v3[arr];
46print("test successful !!!");
47
48var obj1 = {
49    0: 0,
50    2147483647: 1,
51    2147483648: 2,
52    4294967295: 3,
53    4294967296: 4,
54}
55
56for (let item in obj1) {
57    print(item + " " + obj1[item]);
58}