• 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
16class Type {}
17var result = false;
18const TypeClassFactory = (tagClass) => class extends Type {
19  constructor(tagClass) {
20    super();
21    if (tagClass != null) this.tagClass = tagClass;
22    result = ArkTools.isInFastJit();
23  }
24};
25
26class Universal {}
27Universal.EOC = class EOC extends TypeClassFactory(Universal) {};
28Universal.Bool = class Bool extends TypeClassFactory(Universal) {};
29
30for (let i = 0; i < 1000; i++) {
31    new Universal.EOC();
32}
33ArkTools.waitAllJitCompileFinish();
34for (let i = 0; i < 1000; i++) {
35    new Universal.Bool();
36}
37ArkTools.waitAllJitCompileFinish();
38result = false;
39new Universal.EOC();
40print(result);
41result = false;
42new Universal.Bool();
43print(result)
44