• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #include "ecmascript/base/string_helper.h"
17 #include "ecmascript/ecma_vm.h"
18 #include "ecmascript/global_env.h"
19 #include "ecmascript/interpreter/fast_runtime_stub-inl.h"
20 #include "ecmascript/js_function.h"
21 #include "ecmascript/js_thread.h"
22 #include "ecmascript/platform/time.h"
23 #include "ecmascript/tests/test_helper.h"
24 
25 using namespace panda::ecmascript;
26 
27 namespace panda::test {
28 class BuiltinsLazyTest : public testing::Test {
29 public:
SetUpTestCase()30     static void SetUpTestCase()
31     {
32         GTEST_LOG_(INFO) << "SetUpTestCase";
33     }
34 
TearDownTestCase()35     static void TearDownTestCase()
36     {
37         GTEST_LOG_(INFO) << "TearDownCase";
38     }
39 
SetUp()40     void SetUp() override
41     {
42         JSRuntimeOptions options;
43 #if PANDA_TARGET_LINUX
44         // for consistency requirement, use ohos_icu4j/data as icu-data-path
45         options.SetIcuDataPath(ICU_PATH);
46 #endif
47         options.SetIsWorker(true);
48         options.SetEnableBuiltinsLazy(true);
49         options.SetEnableForceGC(true);
50         instance = JSNApi::CreateEcmaVM(options);
51         instance->SetEnableForceGC(true);
52         ASSERT_TRUE(instance != nullptr) << "Cannot create EcmaVM";
53         thread = instance->GetJSThread();
54         scope = new EcmaHandleScope(thread);
55     }
56 
TearDown()57     void TearDown() override
58     {
59         TestHelper::DestroyEcmaVMWithScope(instance, scope);
60     }
61 
62     EcmaVM *instance {nullptr};
63     EcmaHandleScope *scope {nullptr};
64     JSThread *thread {nullptr};
65 };
66 
HWTEST_F_L0(BuiltinsLazyTest,SlowGetOwnProperty)67 HWTEST_F_L0(BuiltinsLazyTest, SlowGetOwnProperty)
68 {
69     EcmaVM *ecmaVM = thread->GetEcmaVM();
70     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
71     ObjectFactory *factory = ecmaVM->GetFactory();
72     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("Date"));
73     auto globalObj = JSHandle<JSObject>(thread, globalEnv->GetGlobalObject());
74     PropertyDescriptor desc(thread);
75     bool success = JSObject::GetOwnProperty(thread, globalObj, key, desc);
76     ASSERT_TRUE(success);
77     ASSERT_TRUE(desc.GetValue()->IsJSFunction());
78 }
79 
HWTEST_F_L0(BuiltinsLazyTest,SlowSetProperty)80 HWTEST_F_L0(BuiltinsLazyTest, SlowSetProperty)
81 {
82     EcmaVM *ecmaVM = thread->GetEcmaVM();
83     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
84     ObjectFactory *factory = ecmaVM->GetFactory();
85     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("Date"));
86     auto globalObj = JSHandle<JSTaggedValue>(thread, globalEnv->GetGlobalObject());
87     JSHandle<JSTaggedValue> value(factory->NewFromUtf8("Value"));
88     bool success = JSObject::SetProperty(thread, globalObj, key, value);
89     ASSERT_TRUE(success);
90     PropertyDescriptor desc(thread);
91     JSObject::GetOwnProperty(thread, JSHandle<JSObject>::Cast(globalObj), key, desc);
92     ASSERT_FALSE(desc.IsAccessorDescriptor());
93 }
94 
HWTEST_F_L0(BuiltinsLazyTest,EnvGetDateConstructorTest)95 HWTEST_F_L0(BuiltinsLazyTest, EnvGetDateConstructorTest)
96 {
97     EcmaVM *ecmaVM = thread->GetEcmaVM();
98     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
99     JSHandle<JSTaggedValue> dateFunction = globalEnv->GetDateFunction();
100     ASSERT_TRUE(dateFunction->IsJSFunction());
101     ObjectFactory *factory = ecmaVM->GetFactory();
102     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("now"));
103     ASSERT_TRUE(JSTaggedValue::HasProperty(thread, dateFunction, key));
104 }
105 
HWTEST_F_L0(BuiltinsLazyTest,GlobalGetDateConstructorTest)106 HWTEST_F_L0(BuiltinsLazyTest, GlobalGetDateConstructorTest)
107 {
108     EcmaVM *ecmaVM = thread->GetEcmaVM();
109     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
110     ObjectFactory *factory = ecmaVM->GetFactory();
111     auto key = factory->NewFromUtf8("Date");
112     auto globalObj = globalEnv->GetGlobalObject();
113     auto dateFunction = FastRuntimeStub::GetGlobalOwnProperty(thread, globalObj, key.GetTaggedValue());
114     ASSERT_TRUE(dateFunction.IsJSFunction());
115 }
116 
HWTEST_F_L0(BuiltinsLazyTest,EnvGetSetConstructorTest)117 HWTEST_F_L0(BuiltinsLazyTest, EnvGetSetConstructorTest)
118 {
119     EcmaVM *ecmaVM = thread->GetEcmaVM();
120     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
121     JSHandle<JSTaggedValue> setFunction = globalEnv->GetBuiltinsSetFunction();
122     ASSERT_TRUE(setFunction->IsJSFunction());
123     ObjectFactory *factory = ecmaVM->GetFactory();
124     JSHandle<JSTaggedValue> setObject(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(setFunction),
125         setFunction));
126     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("add"));
127     ASSERT_TRUE(JSTaggedValue::HasProperty(thread, setObject, key));
128 }
129 
HWTEST_F_L0(BuiltinsLazyTest,GlobalGetSetConstructorTest)130 HWTEST_F_L0(BuiltinsLazyTest, GlobalGetSetConstructorTest)
131 {
132     EcmaVM *ecmaVM = thread->GetEcmaVM();
133     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
134     ObjectFactory *factory = ecmaVM->GetFactory();
135     JSTaggedValue key = factory->NewFromUtf8("Set").GetTaggedValue();
136     auto globalObj = globalEnv->GetGlobalObject();
137     auto setFunction = FastRuntimeStub::GetGlobalOwnProperty(thread, globalObj, key);
138     ASSERT_TRUE(setFunction.IsJSFunction());
139 }
140 
HWTEST_F_L0(BuiltinsLazyTest,EnvGetMapConstructorTest)141 HWTEST_F_L0(BuiltinsLazyTest, EnvGetMapConstructorTest)
142 {
143     EcmaVM *ecmaVM = thread->GetEcmaVM();
144     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
145     JSHandle<JSTaggedValue> mapFunction = globalEnv->GetBuiltinsMapFunction();
146     ASSERT_TRUE(mapFunction->IsJSFunction());
147     ObjectFactory *factory = ecmaVM->GetFactory();
148     JSHandle<JSTaggedValue> mapObject(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(mapFunction),
149         mapFunction));
150     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("clear"));
151     ASSERT_TRUE(JSTaggedValue::HasProperty(thread, mapObject, key));
152 }
153 
HWTEST_F_L0(BuiltinsLazyTest,GlobalGetMapConstructorTest)154 HWTEST_F_L0(BuiltinsLazyTest, GlobalGetMapConstructorTest)
155 {
156     EcmaVM *ecmaVM = thread->GetEcmaVM();
157     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
158     ObjectFactory *factory = ecmaVM->GetFactory();
159     JSTaggedValue key = factory->NewFromUtf8("Map").GetTaggedValue();
160     auto globalObj = globalEnv->GetGlobalObject();
161     auto mapFunction = FastRuntimeStub::GetGlobalOwnProperty(thread, globalObj, key);
162     ASSERT_TRUE(mapFunction.IsJSFunction());
163 }
164 
HWTEST_F_L0(BuiltinsLazyTest,EnvGetWeakMapConstructorTest)165 HWTEST_F_L0(BuiltinsLazyTest, EnvGetWeakMapConstructorTest)
166 {
167     EcmaVM *ecmaVM = thread->GetEcmaVM();
168     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
169     JSHandle<JSTaggedValue> weakMapFunction = globalEnv->GetBuiltinsWeakMapFunction();
170     ASSERT_TRUE(weakMapFunction->IsJSFunction());
171     ObjectFactory *factory = ecmaVM->GetFactory();
172     JSHandle<JSTaggedValue> weakMapObject(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(weakMapFunction),
173         weakMapFunction));
174     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("delete"));
175     ASSERT_TRUE(JSTaggedValue::HasProperty(thread, weakMapObject, key));
176 }
177 
HWTEST_F_L0(BuiltinsLazyTest,GlobalGetWeakMapConstructorTest)178 HWTEST_F_L0(BuiltinsLazyTest, GlobalGetWeakMapConstructorTest)
179 {
180     EcmaVM *ecmaVM = thread->GetEcmaVM();
181     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
182     ObjectFactory *factory = ecmaVM->GetFactory();
183     JSTaggedValue key = factory->NewFromUtf8("WeakMap").GetTaggedValue();
184     auto globalObj = globalEnv->GetGlobalObject();
185     auto weakMapFunction = FastRuntimeStub::GetGlobalOwnProperty(thread, globalObj, key);
186     ASSERT_TRUE(weakMapFunction.IsJSFunction());
187 }
188 
HWTEST_F_L0(BuiltinsLazyTest,EnvGetWeakSetConstructorTest)189 HWTEST_F_L0(BuiltinsLazyTest, EnvGetWeakSetConstructorTest)
190 {
191     EcmaVM *ecmaVM = thread->GetEcmaVM();
192     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
193     JSHandle<JSTaggedValue> weakSetFunction = globalEnv->GetBuiltinsWeakSetFunction();
194     ASSERT_TRUE(weakSetFunction->IsJSFunction());
195     ObjectFactory *factory = ecmaVM->GetFactory();
196     JSHandle<JSTaggedValue> weakSetObject(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(weakSetFunction),
197         weakSetFunction));
198     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("delete"));
199     ASSERT_TRUE(JSTaggedValue::HasProperty(thread, weakSetObject, key));
200 }
201 
HWTEST_F_L0(BuiltinsLazyTest,GlobalGetWeakSetConstructorTest)202 HWTEST_F_L0(BuiltinsLazyTest, GlobalGetWeakSetConstructorTest)
203 {
204     EcmaVM *ecmaVM = thread->GetEcmaVM();
205     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
206     ObjectFactory *factory = ecmaVM->GetFactory();
207     JSTaggedValue key = factory->NewFromUtf8("WeakSet").GetTaggedValue();
208     auto globalObj = globalEnv->GetGlobalObject();
209     auto weakSetFunction = FastRuntimeStub::GetGlobalOwnProperty(thread, globalObj, key);
210     ASSERT_TRUE(weakSetFunction.IsJSFunction());
211 }
212 
HWTEST_F_L0(BuiltinsLazyTest,EnvGetWeakRefConstructorTest)213 HWTEST_F_L0(BuiltinsLazyTest, EnvGetWeakRefConstructorTest)
214 {
215     EcmaVM *ecmaVM = thread->GetEcmaVM();
216     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
217     JSHandle<JSTaggedValue> weakRefFunction = globalEnv->GetBuiltinsWeakRefFunction();
218     ASSERT_TRUE(weakRefFunction->IsJSFunction());
219     ObjectFactory *factory = ecmaVM->GetFactory();
220     JSHandle<JSTaggedValue> weakRefObject(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(weakRefFunction),
221         weakRefFunction));
222     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("deref"));
223     ASSERT_TRUE(JSTaggedValue::HasProperty(thread, weakRefObject, key));
224 }
225 
HWTEST_F_L0(BuiltinsLazyTest,GlobalGetWeakRefConstructorTest)226 HWTEST_F_L0(BuiltinsLazyTest, GlobalGetWeakRefConstructorTest)
227 {
228     EcmaVM *ecmaVM = thread->GetEcmaVM();
229     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
230     ObjectFactory *factory = ecmaVM->GetFactory();
231     JSTaggedValue key = factory->NewFromUtf8("WeakRef").GetTaggedValue();
232     auto globalObj = globalEnv->GetGlobalObject();
233     auto weakRefFunction = FastRuntimeStub::GetGlobalOwnProperty(thread, globalObj, key);
234     ASSERT_TRUE(weakRefFunction.IsJSFunction());
235 }
236 
HWTEST_F_L0(BuiltinsLazyTest,EnvGetFinalizationRegistryConstructorTest)237 HWTEST_F_L0(BuiltinsLazyTest, EnvGetFinalizationRegistryConstructorTest)
238 {
239     EcmaVM *ecmaVM = thread->GetEcmaVM();
240     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
241     JSHandle<JSTaggedValue> function = globalEnv->GetBuiltinsFinalizationRegistryFunction();
242     ASSERT_TRUE(function->IsJSFunction());
243     ObjectFactory *factory = ecmaVM->GetFactory();
244     JSHandle<JSTaggedValue> object(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(function), function));
245     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("register"));
246     ASSERT_TRUE(JSTaggedValue::HasProperty(thread, object, key));
247 }
248 
HWTEST_F_L0(BuiltinsLazyTest,GlobalGetFinalizationRegistryConstructorTest)249 HWTEST_F_L0(BuiltinsLazyTest, GlobalGetFinalizationRegistryConstructorTest)
250 {
251     EcmaVM *ecmaVM = thread->GetEcmaVM();
252     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
253     ObjectFactory *factory = ecmaVM->GetFactory();
254     JSTaggedValue key = factory->NewFromUtf8("FinalizationRegistry").GetTaggedValue();
255     auto globalObj = globalEnv->GetGlobalObject();
256     auto function = FastRuntimeStub::GetGlobalOwnProperty(thread, globalObj, key);
257     ASSERT_TRUE(function.IsJSFunction());
258 }
259 
HWTEST_F_L0(BuiltinsLazyTest,EnvGetInt8ArrayConstructorTest)260 HWTEST_F_L0(BuiltinsLazyTest, EnvGetInt8ArrayConstructorTest)
261 {
262     EcmaVM *ecmaVM = thread->GetEcmaVM();
263     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
264     JSHandle<JSTaggedValue> function = globalEnv->GetInt8ArrayFunction();
265     ASSERT_TRUE(function->IsJSFunction());
266     ObjectFactory *factory = ecmaVM->GetFactory();
267     JSHandle<JSTaggedValue> object(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(function), function));
268     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("BYTES_PER_ELEMENT"));
269     ASSERT_TRUE(JSTaggedValue::HasProperty(thread, object, key));
270 }
271 
HWTEST_F_L0(BuiltinsLazyTest,GlobalGetInt8ArrayConstructorTest)272 HWTEST_F_L0(BuiltinsLazyTest, GlobalGetInt8ArrayConstructorTest)
273 {
274     EcmaVM *ecmaVM = thread->GetEcmaVM();
275     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
276     ObjectFactory *factory = ecmaVM->GetFactory();
277     JSTaggedValue key = factory->NewFromUtf8("Int8Array").GetTaggedValue();
278     auto globalObj = globalEnv->GetGlobalObject();
279     auto function = FastRuntimeStub::GetGlobalOwnProperty(thread, globalObj, key);
280     ASSERT_TRUE(function.IsJSFunction());
281 }
282 
HWTEST_F_L0(BuiltinsLazyTest,EnvGetArrayBufferConstructorTest)283 HWTEST_F_L0(BuiltinsLazyTest, EnvGetArrayBufferConstructorTest)
284 {
285     EcmaVM *ecmaVM = thread->GetEcmaVM();
286     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
287     JSHandle<JSTaggedValue> function = globalEnv->GetArrayBufferFunction();
288     ASSERT_TRUE(function->IsJSFunction());
289     ObjectFactory *factory = ecmaVM->GetFactory();
290     JSHandle<JSTaggedValue> object(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(function), function));
291     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("slice"));
292     ASSERT_TRUE(JSTaggedValue::HasProperty(thread, object, key));
293 }
294 
HWTEST_F_L0(BuiltinsLazyTest,GlobalGetArrayBufferConstructorTest)295 HWTEST_F_L0(BuiltinsLazyTest, GlobalGetArrayBufferConstructorTest)
296 {
297     EcmaVM *ecmaVM = thread->GetEcmaVM();
298     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
299     ObjectFactory *factory = ecmaVM->GetFactory();
300     JSTaggedValue key = factory->NewFromUtf8("ArrayBuffer").GetTaggedValue();
301     auto globalObj = globalEnv->GetGlobalObject();
302     auto function = FastRuntimeStub::GetGlobalOwnProperty(thread, globalObj, key);
303     ASSERT_TRUE(function.IsJSFunction());
304 }
305 
HWTEST_F_L0(BuiltinsLazyTest,EnvGetDataViewConstructorTest)306 HWTEST_F_L0(BuiltinsLazyTest, EnvGetDataViewConstructorTest)
307 {
308     EcmaVM *ecmaVM = thread->GetEcmaVM();
309     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
310     JSHandle<JSTaggedValue> function = globalEnv->GetDataViewFunction();
311     ASSERT_TRUE(function->IsJSFunction());
312     ObjectFactory *factory = ecmaVM->GetFactory();
313     JSHandle<JSTaggedValue> object(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(function), function));
314     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("getFloat32"));
315     ASSERT_TRUE(JSTaggedValue::HasProperty(thread, object, key));
316 }
317 
HWTEST_F_L0(BuiltinsLazyTest,GlobalGetDataViewConstructorTest)318 HWTEST_F_L0(BuiltinsLazyTest, GlobalGetDataViewConstructorTest)
319 {
320     EcmaVM *ecmaVM = thread->GetEcmaVM();
321     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
322     ObjectFactory *factory = ecmaVM->GetFactory();
323     JSTaggedValue key = factory->NewFromUtf8("DataView").GetTaggedValue();
324     auto globalObj = globalEnv->GetGlobalObject();
325     auto function = FastRuntimeStub::GetGlobalOwnProperty(thread, globalObj, key);
326     ASSERT_TRUE(function.IsJSFunction());
327 }
328 
HWTEST_F_L0(BuiltinsLazyTest,EnvGetSharedArrayBufferConstructorTest)329 HWTEST_F_L0(BuiltinsLazyTest, EnvGetSharedArrayBufferConstructorTest)
330 {
331     EcmaVM *ecmaVM = thread->GetEcmaVM();
332     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
333     JSHandle<JSTaggedValue> function = globalEnv->GetSharedArrayBufferFunction();
334     ASSERT_TRUE(function->IsJSFunction());
335     ObjectFactory *factory = ecmaVM->GetFactory();
336     JSHandle<JSTaggedValue> object(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(function), function));
337     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("slice"));
338     ASSERT_TRUE(JSTaggedValue::HasProperty(thread, object, key));
339 }
340 
HWTEST_F_L0(BuiltinsLazyTest,GlobalGetSharedArrayBufferConstructorTest)341 HWTEST_F_L0(BuiltinsLazyTest, GlobalGetSharedArrayBufferConstructorTest)
342 {
343     EcmaVM *ecmaVM = thread->GetEcmaVM();
344     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
345     ObjectFactory *factory = ecmaVM->GetFactory();
346     JSTaggedValue key = factory->NewFromUtf8("SharedArrayBuffer").GetTaggedValue();
347     auto globalObj = globalEnv->GetGlobalObject();
348     auto function = FastRuntimeStub::GetGlobalOwnProperty(thread, globalObj, key);
349     ASSERT_TRUE(function.IsJSFunction());
350 }
351 
HWTEST_F_L0(BuiltinsLazyTest,EnvGetLocaleConstructorTest)352 HWTEST_F_L0(BuiltinsLazyTest, EnvGetLocaleConstructorTest)
353 {
354     EcmaVM *ecmaVM = thread->GetEcmaVM();
355     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
356     JSHandle<JSTaggedValue> function = globalEnv->GetLocaleFunction();
357     ASSERT_TRUE(function->IsJSFunction());
358     ObjectFactory *factory = ecmaVM->GetFactory();
359     JSHandle<JSTaggedValue> object(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(function), function));
360     JSHandle<JSTaggedValue> key(factory->NewFromUtf8("maximize"));
361     ASSERT_TRUE(JSTaggedValue::HasProperty(thread, object, key));
362 }
363 
HWTEST_F_L0(BuiltinsLazyTest,IntlGetLocaleFunctionConstructorTest)364 HWTEST_F_L0(BuiltinsLazyTest, IntlGetLocaleFunctionConstructorTest)
365 {
366     EcmaVM *ecmaVM = thread->GetEcmaVM();
367     JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv();
368     ObjectFactory *factory = ecmaVM->GetFactory();
369     JSTaggedValue key = factory->NewFromUtf8("Locale").GetTaggedValue();
370     auto intlObj = globalEnv->GetIntlFunction().GetTaggedValue();
371     auto function = FastRuntimeStub::GetPropertyByName(thread, intlObj, key);
372     ASSERT_TRUE(function.IsJSFunction());
373 }
374 }  // namespace panda::test
375