• 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}
59// test ic
60var lineStr = "方舟ArK TypeScript RuntimekTS运行时(ARK TypeScript Runtime)K TypeScript Runtime是OppeScript RK TypeScripK TypeScript Runtimet Runtimeuntime)是OpeK TypeScript RuntimenHarmony上ArkTS应用使用的运行时。包含ArkTS/JS对象的分配enHarmonypeScript Runtime)是OpenHarmony上ArkTS应用使用的运行时。包含ArkTS/JS对象的分配上ArkTS应用使用peScript Runtime)是OpenHarmony上ArkTS应用使用的运行时。包含ArkTS/JS对象的分配的运行时。包含ArkTS/JS对象的分配器以及垃圾回收器(GC)、符合ECMAScript规范的标准库、用于运行ARK前端组件生成的方舟字节码(ARK Bytecode简称abc)的解释器、用于加速的内联缓存、静态类型编译器、运行时的C++/C函数接口(NAPI)等模块.";
61var str = "方舟ArkTS运行时(ARK TypeScript Runtime)是OpenHarmony上ArkTS应用使用的运行时。包含ArkTS/JS对象的分配器以及垃圾回收器(GC)、符合ECMAScript规范的标准库、用于运行ARK前端组件生成的方舟字节码(ARK Bytecode简称abc)的解释器、用于加速的内联缓存、静态类型编译器、运行时的C++/C函数接口(NAPI)等模块.";
62str += str;
63str += str;
64str += str;
65var c;
66var l;
67var strC;
68for (let i = 0;i < 100;i++){
69  strC = str.split("C");
70  c = str[i];
71  l = str.length;
72  strC = lineStr.split("C");
73  c = lineStr[i];
74  l = lineStr.length;
75}
76var strObj = new String("方舟ArkTS运行时(ARK TypeScript Runtime)是OpenHarmony上ArkTS应用使用的运行时。包含ArkTS/JS对象的分配器以及垃圾回收器(GC)、符合ECMAScript规范的标准库、用于运行ARK前端组件生成的方舟字节码(ARK Bytecode简称abc)的解释器、用于加速的内联缓存、静态类型编译器、运行时的C++/C函数接口(NAPI)等模块.");
77for (let i = 0;i < 100;i++){
78    strC = strObj.split("C");
79    c = strObj[i];
80    l = strObj.length;
81  }
82print("ic load success");
83