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 #include "ecmascript/interpreter/slow_runtime_stub.h"
17
18 #include "ecmascript/base/number_helper.h"
19 #include "ecmascript/builtins/builtins_regexp.h"
20 #include "ecmascript/global_dictionary-inl.h"
21 #include "ecmascript/ic/profile_type_info.h"
22 #include "ecmascript/interpreter/interpreter-inl.h"
23 #include "ecmascript/jobs/micro_job_queue.h"
24 #include "ecmascript/jspandafile/program_object.h"
25 #include "ecmascript/jspandafile/scope_info_extractor.h"
26 #include "ecmascript/js_arguments.h"
27 #include "ecmascript/js_array.h"
28 #include "ecmascript/js_array_iterator.h"
29 #include "ecmascript/js_async_function.h"
30 #include "ecmascript/js_async_generator_object.h"
31 #include "ecmascript/js_for_in_iterator.h"
32 #include "ecmascript/js_function.h"
33 #include "ecmascript/js_generator_object.h"
34 #include "ecmascript/js_hclass-inl.h"
35 #include "ecmascript/js_iterator.h"
36 #include "ecmascript/js_promise.h"
37 #include "ecmascript/js_proxy.h"
38 #include "ecmascript/js_tagged_value-inl.h"
39 #include "ecmascript/js_thread.h"
40 #include "ecmascript/module/js_module_manager.h"
41 #include "ecmascript/tagged_dictionary.h"
42 #include "ecmascript/runtime_call_id.h"
43 #include "ecmascript/template_string.h"
44 #include "ecmascript/stubs/runtime_stubs-inl.h"
45
46 namespace panda::ecmascript {
CallSpread(JSThread * thread,JSTaggedValue func,JSTaggedValue obj,JSTaggedValue array)47 JSTaggedValue SlowRuntimeStub::CallSpread(JSThread *thread, JSTaggedValue func, JSTaggedValue obj,
48 JSTaggedValue array)
49 {
50 INTERPRETER_TRACE(thread, CallSpread);
51 [[maybe_unused]] EcmaHandleScope handleScope(thread);
52
53 JSHandle<JSTaggedValue> jsFunc(thread, func);
54 JSHandle<JSTaggedValue> jsArray(thread, array);
55 JSHandle<JSTaggedValue> taggedObj(thread, obj);
56 return RuntimeStubs::RuntimeCallSpread(thread, jsFunc, taggedObj, jsArray);
57 }
58
Neg(JSThread * thread,JSTaggedValue value)59 JSTaggedValue SlowRuntimeStub::Neg(JSThread *thread, JSTaggedValue value)
60 {
61 INTERPRETER_TRACE(thread, Neg);
62 [[maybe_unused]] EcmaHandleScope handleScope(thread);
63
64 JSHandle<JSTaggedValue> inputTag(thread, value);
65 return RuntimeStubs::RuntimeNeg(thread, inputTag);
66 }
67
AsyncFunctionEnter(JSThread * thread)68 JSTaggedValue SlowRuntimeStub::AsyncFunctionEnter(JSThread *thread)
69 {
70 INTERPRETER_TRACE(thread, AsyncFunctionEnter);
71 [[maybe_unused]] EcmaHandleScope handleScope(thread);
72
73 return RuntimeStubs::RuntimeAsyncFunctionEnter(thread);
74 }
75
ToNumber(JSThread * thread,JSTaggedValue value)76 JSTaggedValue SlowRuntimeStub::ToNumber(JSThread *thread, JSTaggedValue value)
77 {
78 INTERPRETER_TRACE(thread, Tonumber);
79 [[maybe_unused]] EcmaHandleScope handleScope(thread);
80
81 JSHandle<JSTaggedValue> number(thread, value);
82 // may return exception
83 return RuntimeStubs::RuntimeToNumber(thread, number);
84 }
85
ToNumeric(JSThread * thread,JSTaggedValue value)86 JSTaggedValue SlowRuntimeStub::ToNumeric(JSThread *thread, JSTaggedValue value)
87 {
88 INTERPRETER_TRACE(thread, Tonumeric);
89 [[maybe_unused]] EcmaHandleScope handleScope(thread);
90
91 JSHandle<JSTaggedValue> numeric(thread, value);
92 // may return exception
93 return RuntimeStubs::RuntimeToNumeric(thread, numeric);
94 }
95
Not(JSThread * thread,JSTaggedValue value)96 JSTaggedValue SlowRuntimeStub::Not(JSThread *thread, JSTaggedValue value)
97 {
98 INTERPRETER_TRACE(thread, Not);
99 [[maybe_unused]] EcmaHandleScope handleScope(thread);
100
101 JSHandle<JSTaggedValue> inputTag(thread, value);
102 return RuntimeStubs::RuntimeNot(thread, inputTag);
103 }
104
Inc(JSThread * thread,JSTaggedValue value)105 JSTaggedValue SlowRuntimeStub::Inc(JSThread *thread, JSTaggedValue value)
106 {
107 INTERPRETER_TRACE(thread, Inc);
108 [[maybe_unused]] EcmaHandleScope handleScope(thread);
109
110 JSHandle<JSTaggedValue> inputTag(thread, value);
111 return RuntimeStubs::RuntimeInc(thread, inputTag);
112 }
113
Dec(JSThread * thread,JSTaggedValue value)114 JSTaggedValue SlowRuntimeStub::Dec(JSThread *thread, JSTaggedValue value)
115 {
116 INTERPRETER_TRACE(thread, Dec);
117 [[maybe_unused]] EcmaHandleScope handleScope(thread);
118
119 JSHandle<JSTaggedValue> inputTag(thread, value);
120 return RuntimeStubs::RuntimeDec(thread, inputTag);
121 }
122
Throw(JSThread * thread,JSTaggedValue value)123 void SlowRuntimeStub::Throw(JSThread *thread, JSTaggedValue value)
124 {
125 INTERPRETER_TRACE(thread, Throw);
126 RuntimeStubs::RuntimeThrow(thread, value);
127 }
128
GetPropIterator(JSThread * thread,JSTaggedValue value)129 JSTaggedValue SlowRuntimeStub::GetPropIterator(JSThread *thread, JSTaggedValue value)
130 {
131 INTERPRETER_TRACE(thread, GetPropIterator);
132 [[maybe_unused]] EcmaHandleScope handleScope(thread);
133
134 JSHandle<JSTaggedValue> objHandle(thread, value);
135 return RuntimeStubs::RuntimeGetPropIterator(thread, objHandle);
136 }
137
ThrowConstAssignment(JSThread * thread,JSTaggedValue value)138 void SlowRuntimeStub::ThrowConstAssignment(JSThread *thread, JSTaggedValue value)
139 {
140 INTERPRETER_TRACE(thread, ThrowConstAssignment);
141 [[maybe_unused]] EcmaHandleScope handleScope(thread);
142
143 JSHandle<EcmaString> name(thread, value.GetTaggedObject());
144 return RuntimeStubs::RuntimeThrowConstAssignment(thread, name);
145 }
146
Add2(JSThread * thread,JSTaggedValue left,JSTaggedValue right)147 JSTaggedValue SlowRuntimeStub::Add2(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
148 {
149 INTERPRETER_TRACE(thread, Add2);
150 [[maybe_unused]] EcmaHandleScope handleScope(thread);
151
152 JSHandle<JSTaggedValue> leftValue(thread, left);
153 JSHandle<JSTaggedValue> rightValue(thread, right);
154 return RuntimeStubs::RuntimeAdd2(thread, leftValue, rightValue);
155 }
156
Sub2(JSThread * thread,JSTaggedValue left,JSTaggedValue right)157 JSTaggedValue SlowRuntimeStub::Sub2(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
158 {
159 INTERPRETER_TRACE(thread, Sub2);
160 [[maybe_unused]] EcmaHandleScope handleScope(thread);
161
162 JSHandle<JSTaggedValue> leftTag(thread, left);
163 JSHandle<JSTaggedValue> rightTag(thread, right);
164 return RuntimeStubs::RuntimeSub2(thread, leftTag, rightTag);
165 }
166
Mul2(JSThread * thread,JSTaggedValue left,JSTaggedValue right)167 JSTaggedValue SlowRuntimeStub::Mul2(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
168 {
169 INTERPRETER_TRACE(thread, Mul2);
170 [[maybe_unused]] EcmaHandleScope handleScope(thread);
171
172 JSHandle<JSTaggedValue> leftTag(thread, left);
173 JSHandle<JSTaggedValue> rightTag(thread, right);
174 return RuntimeStubs::RuntimeMul2(thread, leftTag, rightTag);
175 }
176
Div2(JSThread * thread,JSTaggedValue left,JSTaggedValue right)177 JSTaggedValue SlowRuntimeStub::Div2(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
178 {
179 INTERPRETER_TRACE(thread, Div2);
180 [[maybe_unused]] EcmaHandleScope handleScope(thread);
181
182 JSHandle<JSTaggedValue> leftTag(thread, left);
183 JSHandle<JSTaggedValue> rightTag(thread, right);
184 return RuntimeStubs::RuntimeDiv2(thread, leftTag, rightTag);
185 }
186
Mod2(JSThread * thread,JSTaggedValue left,JSTaggedValue right)187 JSTaggedValue SlowRuntimeStub::Mod2(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
188 {
189 INTERPRETER_TRACE(thread, Mod2);
190 [[maybe_unused]] EcmaHandleScope handleScope(thread);
191
192 JSHandle<JSTaggedValue> leftTag(thread, left);
193 JSHandle<JSTaggedValue> rightTag(thread, right);
194 return RuntimeStubs::RuntimeMod2(thread, leftTag, rightTag);
195 }
196
Eq(JSThread * thread,JSTaggedValue left,JSTaggedValue right)197 JSTaggedValue SlowRuntimeStub::Eq(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
198 {
199 INTERPRETER_TRACE(thread, Eq);
200 [[maybe_unused]] EcmaHandleScope handleScope(thread);
201
202 JSHandle<JSTaggedValue> leftValue(thread, left);
203 JSHandle<JSTaggedValue> rightValue(thread, right);
204 return RuntimeStubs::RuntimeEq(thread, leftValue, rightValue);
205 }
206
NotEq(JSThread * thread,JSTaggedValue left,JSTaggedValue right)207 JSTaggedValue SlowRuntimeStub::NotEq(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
208 {
209 INTERPRETER_TRACE(thread, NotEq);
210 [[maybe_unused]] EcmaHandleScope handleScope(thread);
211
212 JSHandle<JSTaggedValue> leftValue(thread, left);
213 JSHandle<JSTaggedValue> rightValue(thread, right);
214 return RuntimeStubs::RuntimeNotEq(thread, leftValue, rightValue);
215 }
216
Less(JSThread * thread,JSTaggedValue left,JSTaggedValue right)217 JSTaggedValue SlowRuntimeStub::Less(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
218 {
219 INTERPRETER_TRACE(thread, Less);
220 [[maybe_unused]] EcmaHandleScope handleScope(thread);
221
222 JSHandle<JSTaggedValue> leftValue(thread, left);
223 JSHandle<JSTaggedValue> rightValue(thread, right);
224 return RuntimeStubs::RuntimeLess(thread, leftValue, rightValue);
225 }
226
LessEq(JSThread * thread,JSTaggedValue left,JSTaggedValue right)227 JSTaggedValue SlowRuntimeStub::LessEq(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
228 {
229 INTERPRETER_TRACE(thread, LessEq);
230 [[maybe_unused]] EcmaHandleScope handleScope(thread);
231
232 JSHandle<JSTaggedValue> leftValue(thread, left);
233 JSHandle<JSTaggedValue> rightValue(thread, right);
234 return RuntimeStubs::RuntimeLessEq(thread, leftValue, rightValue);
235 }
236
Greater(JSThread * thread,JSTaggedValue left,JSTaggedValue right)237 JSTaggedValue SlowRuntimeStub::Greater(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
238 {
239 INTERPRETER_TRACE(thread, Greater);
240 [[maybe_unused]] EcmaHandleScope handleScope(thread);
241
242 JSHandle<JSTaggedValue> leftValue(thread, left);
243 JSHandle<JSTaggedValue> rightValue(thread, right);
244 return RuntimeStubs::RuntimeGreater(thread, leftValue, rightValue);
245 }
246
GreaterEq(JSThread * thread,JSTaggedValue left,JSTaggedValue right)247 JSTaggedValue SlowRuntimeStub::GreaterEq(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
248 {
249 INTERPRETER_TRACE(thread, GreaterEq);
250 [[maybe_unused]] EcmaHandleScope handleScope(thread);
251
252 JSHandle<JSTaggedValue> leftValue(thread, left);
253 JSHandle<JSTaggedValue> rightValue(thread, right);
254 return RuntimeStubs::RuntimeGreaterEq(thread, leftValue, rightValue);
255 }
256
Shl2(JSThread * thread,JSTaggedValue left,JSTaggedValue right)257 JSTaggedValue SlowRuntimeStub::Shl2(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
258 {
259 INTERPRETER_TRACE(thread, Shl2);
260 [[maybe_unused]] EcmaHandleScope handleScope(thread);
261
262 JSHandle<JSTaggedValue> leftTag(thread, left);
263 JSHandle<JSTaggedValue> rightTag(thread, right);
264 return RuntimeStubs::RuntimeShl2(thread, leftTag, rightTag);
265 }
266
Shr2(JSThread * thread,JSTaggedValue left,JSTaggedValue right)267 JSTaggedValue SlowRuntimeStub::Shr2(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
268 {
269 INTERPRETER_TRACE(thread, Shr2);
270 [[maybe_unused]] EcmaHandleScope handleScope(thread);
271
272 JSHandle<JSTaggedValue> leftTag(thread, left);
273 JSHandle<JSTaggedValue> rightTag(thread, right);
274 return RuntimeStubs::RuntimeShr2(thread, leftTag, rightTag);
275 }
276
Ashr2(JSThread * thread,JSTaggedValue left,JSTaggedValue right)277 JSTaggedValue SlowRuntimeStub::Ashr2(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
278 {
279 INTERPRETER_TRACE(thread, Ashr2);
280 [[maybe_unused]] EcmaHandleScope handleScope(thread);
281
282 JSHandle<JSTaggedValue> leftTag(thread, left);
283 JSHandle<JSTaggedValue> rightTag(thread, right);
284 return RuntimeStubs::RuntimeAshr2(thread, leftTag, rightTag);
285 }
286
And2(JSThread * thread,JSTaggedValue left,JSTaggedValue right)287 JSTaggedValue SlowRuntimeStub::And2(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
288 {
289 INTERPRETER_TRACE(thread, And2);
290 [[maybe_unused]] EcmaHandleScope handleScope(thread);
291 JSHandle<JSTaggedValue> leftTag(thread, left);
292 JSHandle<JSTaggedValue> rightTag(thread, right);
293 return RuntimeStubs::RuntimeAnd2(thread, leftTag, rightTag);
294 }
295
Or2(JSThread * thread,JSTaggedValue left,JSTaggedValue right)296 JSTaggedValue SlowRuntimeStub::Or2(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
297 {
298 INTERPRETER_TRACE(thread, Or2);
299 [[maybe_unused]] EcmaHandleScope handleScope(thread);
300
301 JSHandle<JSTaggedValue> leftTag(thread, left);
302 JSHandle<JSTaggedValue> rightTag(thread, right);
303 return RuntimeStubs::RuntimeOr2(thread, leftTag, rightTag);
304 }
305
Xor2(JSThread * thread,JSTaggedValue left,JSTaggedValue right)306 JSTaggedValue SlowRuntimeStub::Xor2(JSThread *thread, JSTaggedValue left, JSTaggedValue right)
307 {
308 INTERPRETER_TRACE(thread, Xor2);
309 [[maybe_unused]] EcmaHandleScope handleScope(thread);
310
311 JSHandle<JSTaggedValue> leftTag(thread, left);
312 JSHandle<JSTaggedValue> rightTag(thread, right);
313 return RuntimeStubs::RuntimeXor2(thread, leftTag, rightTag);
314 }
315
ToJSTaggedValueWithInt32(JSThread * thread,JSTaggedValue value)316 JSTaggedValue SlowRuntimeStub::ToJSTaggedValueWithInt32(JSThread *thread, JSTaggedValue value)
317 {
318 INTERPRETER_TRACE(thread, ToJSTaggedValueWithInt32);
319 [[maybe_unused]] EcmaHandleScope handleScope(thread);
320 JSHandle<JSTaggedValue> valueHandle(thread, value);
321 return RuntimeStubs::RuntimeToJSTaggedValueWithInt32(thread, valueHandle);
322 }
323
ToJSTaggedValueWithUint32(JSThread * thread,JSTaggedValue value)324 JSTaggedValue SlowRuntimeStub::ToJSTaggedValueWithUint32(JSThread *thread, JSTaggedValue value)
325 {
326 INTERPRETER_TRACE(thread, ToJSTaggedValueWithUint32);
327 [[maybe_unused]] EcmaHandleScope handleScope(thread);
328 JSHandle<JSTaggedValue> valueHandle(thread, value);
329 return RuntimeStubs::RuntimeToJSTaggedValueWithUint32(thread, valueHandle);
330 }
331
DelObjProp(JSThread * thread,JSTaggedValue obj,JSTaggedValue prop)332 JSTaggedValue SlowRuntimeStub::DelObjProp(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop)
333 {
334 INTERPRETER_TRACE(thread, Delobjprop);
335 [[maybe_unused]] EcmaHandleScope handleScope(thread);
336
337 JSHandle<JSTaggedValue> objHandle(thread, obj);
338 JSHandle<JSTaggedValue> propHandle(thread, prop);
339 return RuntimeStubs::RuntimeDelObjProp(thread, objHandle, propHandle);
340 }
341
NewObjRange(JSThread * thread,JSTaggedValue func,JSTaggedValue newTarget,uint16_t firstArgIdx,uint16_t length)342 JSTaggedValue SlowRuntimeStub::NewObjRange(JSThread *thread, JSTaggedValue func, JSTaggedValue newTarget,
343 uint16_t firstArgIdx, uint16_t length)
344 {
345 INTERPRETER_TRACE(thread, NewobjRange);
346 [[maybe_unused]] EcmaHandleScope handleScope(thread);
347
348 JSHandle<JSTaggedValue> funcHandle(thread, func);
349 JSHandle<JSTaggedValue> newTargetHandle(thread, newTarget);
350 return RuntimeStubs::RuntimeNewObjRange(thread, funcHandle, newTargetHandle, firstArgIdx, length);
351 }
352
CreateObjectWithExcludedKeys(JSThread * thread,uint16_t numKeys,JSTaggedValue objVal,uint16_t firstArgRegIdx)353 JSTaggedValue SlowRuntimeStub::CreateObjectWithExcludedKeys(JSThread *thread, uint16_t numKeys, JSTaggedValue objVal,
354 uint16_t firstArgRegIdx)
355 {
356 INTERPRETER_TRACE(thread, CreateObjectWithExcludedKeys);
357 [[maybe_unused]] EcmaHandleScope handleScope(thread);
358
359 JSHandle<JSTaggedValue> obj(thread, objVal);
360 return RuntimeStubs::RuntimeCreateObjectWithExcludedKeys(thread, numKeys, obj, firstArgRegIdx);
361 }
362
Exp(JSThread * thread,JSTaggedValue base,JSTaggedValue exponent)363 JSTaggedValue SlowRuntimeStub::Exp(JSThread *thread, JSTaggedValue base, JSTaggedValue exponent)
364 {
365 INTERPRETER_TRACE(thread, Exp);
366 [[maybe_unused]] EcmaHandleScope handleScope(thread);
367
368 return RuntimeStubs::RuntimeExp(thread, base, exponent);
369 }
370
IsIn(JSThread * thread,JSTaggedValue prop,JSTaggedValue obj)371 JSTaggedValue SlowRuntimeStub::IsIn(JSThread *thread, JSTaggedValue prop, JSTaggedValue obj)
372 {
373 INTERPRETER_TRACE(thread, IsIn);
374 [[maybe_unused]] EcmaHandleScope handleScope(thread);
375
376 JSHandle<JSTaggedValue> propHandle(thread, prop);
377 JSHandle<JSTaggedValue> objHandle(thread, obj);
378 return RuntimeStubs::RuntimeIsIn(thread, propHandle, objHandle);
379 }
380
Instanceof(JSThread * thread,JSTaggedValue obj,JSTaggedValue target)381 JSTaggedValue SlowRuntimeStub::Instanceof(JSThread *thread, JSTaggedValue obj, JSTaggedValue target)
382 {
383 INTERPRETER_TRACE(thread, Instanceof);
384 [[maybe_unused]] EcmaHandleScope handleScope(thread);
385
386 JSHandle<JSTaggedValue> objHandle(thread, obj);
387 JSHandle<JSTaggedValue> targetHandle(thread, target);
388 return RuntimeStubs::RuntimeInstanceof(thread, objHandle, targetHandle);
389 }
390
InstanceofByHandler(JSThread * thread,JSTaggedValue target,JSTaggedValue object,JSTaggedValue instOfHandler)391 JSTaggedValue SlowRuntimeStub::InstanceofByHandler(JSThread *thread, JSTaggedValue target, JSTaggedValue object,
392 JSTaggedValue instOfHandler)
393 {
394 INTERPRETER_TRACE(thread, InstanceofByHandler);
395 [[maybe_unused]] EcmaHandleScope handleScope(thread);
396
397 JSHandle<JSTaggedValue> objectHandle(thread, object);
398 JSHandle<JSTaggedValue> targetHandle(thread, target);
399 JSHandle<JSTaggedValue> instOfHandle(thread, instOfHandler);
400
401 return RuntimeStubs::RuntimeInstanceofByHandler(thread, targetHandle, objectHandle, instOfHandle);
402 }
403
NewLexicalEnv(JSThread * thread,uint16_t numVars)404 JSTaggedValue SlowRuntimeStub::NewLexicalEnv(JSThread *thread, uint16_t numVars)
405 {
406 INTERPRETER_TRACE(thread, Newlexenv);
407 [[maybe_unused]] EcmaHandleScope handleScope(thread);
408
409 return RuntimeStubs::RuntimeNewLexicalEnv(thread, numVars);
410 }
411
NewLexicalEnvWithName(JSThread * thread,uint16_t numVars,uint16_t scopeId)412 JSTaggedValue SlowRuntimeStub::NewLexicalEnvWithName(JSThread *thread, uint16_t numVars, uint16_t scopeId)
413 {
414 INTERPRETER_TRACE(thread, NewlexenvwithName);
415 [[maybe_unused]] EcmaHandleScope handleScope(thread);
416
417 return RuntimeStubs::RuntimeNewLexicalEnvWithName(thread, numVars, scopeId);
418 }
419
CreateIterResultObj(JSThread * thread,JSTaggedValue value,JSTaggedValue flag)420 JSTaggedValue SlowRuntimeStub::CreateIterResultObj(JSThread *thread, JSTaggedValue value, JSTaggedValue flag)
421 {
422 INTERPRETER_TRACE(thread, CreateIterResultObj);
423 [[maybe_unused]] EcmaHandleScope handleScope(thread);
424
425 JSHandle<JSTaggedValue> valueHandle(thread, value);
426 return RuntimeStubs::RuntimeCreateIterResultObj(thread, valueHandle, flag);
427 }
428
CreateGeneratorObj(JSThread * thread,JSTaggedValue genFunc)429 JSTaggedValue SlowRuntimeStub::CreateGeneratorObj(JSThread *thread, JSTaggedValue genFunc)
430 {
431 INTERPRETER_TRACE(thread, CreateGeneratorObj);
432 [[maybe_unused]] EcmaHandleScope handleScope(thread);
433
434 JSHandle<JSTaggedValue> generatorFunction(thread, genFunc);
435 return RuntimeStubs::RuntimeCreateGeneratorObj(thread, generatorFunction);
436 }
437
CreateAsyncGeneratorObj(JSThread * thread,JSTaggedValue genFunc)438 JSTaggedValue SlowRuntimeStub::CreateAsyncGeneratorObj(JSThread *thread, JSTaggedValue genFunc)
439 {
440 INTERPRETER_TRACE(thread, CreateAsyncGeneratorObj);
441 [[maybe_unused]] EcmaHandleScope handleScope(thread);
442
443 JSHandle<JSTaggedValue> asyncGeneratorFunction(thread, genFunc);
444 return RuntimeStubs::RuntimeCreateAsyncGeneratorObj(thread, asyncGeneratorFunction);
445 }
446
SuspendGenerator(JSThread * thread,JSTaggedValue genObj,JSTaggedValue value)447 JSTaggedValue SlowRuntimeStub::SuspendGenerator(JSThread *thread, JSTaggedValue genObj, JSTaggedValue value)
448 {
449 INTERPRETER_TRACE(thread, SuspendGenerator);
450 [[maybe_unused]] EcmaHandleScope handleScope(thread);
451
452 JSHandle<JSTaggedValue> genObjHandle(thread, genObj);
453 JSHandle<JSTaggedValue> valueHandle(thread, value);
454 return RuntimeStubs::RuntimeSuspendGenerator(thread, genObjHandle, valueHandle);
455 }
456
SetGeneratorState(JSThread * thread,JSTaggedValue genObj,int32_t index)457 void SlowRuntimeStub::SetGeneratorState(JSThread *thread, JSTaggedValue genObj, int32_t index)
458 {
459 INTERPRETER_TRACE(thread, SetGeneratorState);
460 [[maybe_unused]] EcmaHandleScope handleScope(thread);
461
462 JSHandle<JSTaggedValue> genObjHandle(thread, genObj);
463 return RuntimeStubs::RuntimeSetGeneratorState(thread, genObjHandle, index);
464 }
465
AsyncFunctionAwaitUncaught(JSThread * thread,JSTaggedValue asyncFuncObj,JSTaggedValue value)466 JSTaggedValue SlowRuntimeStub::AsyncFunctionAwaitUncaught(JSThread *thread, JSTaggedValue asyncFuncObj,
467 JSTaggedValue value)
468 {
469 INTERPRETER_TRACE(thread, AsyncFunctionAwaitUncaught);
470 [[maybe_unused]] EcmaHandleScope handleScope(thread);
471 JSHandle<JSTaggedValue> asyncFuncObjHandle(thread, asyncFuncObj);
472 JSHandle<JSTaggedValue> valueHandle(thread, value);
473
474 return RuntimeStubs::RuntimeAsyncFunctionAwaitUncaught(thread, asyncFuncObjHandle, valueHandle);
475 }
476
AsyncFunctionResolveOrReject(JSThread * thread,JSTaggedValue asyncFuncObj,JSTaggedValue value,bool is_resolve)477 JSTaggedValue SlowRuntimeStub::AsyncFunctionResolveOrReject(JSThread *thread, JSTaggedValue asyncFuncObj,
478 JSTaggedValue value, bool is_resolve)
479 {
480 INTERPRETER_TRACE(thread, AsyncFunctionResolveOrReject);
481 [[maybe_unused]] EcmaHandleScope handleScope(thread);
482
483 JSHandle<JSTaggedValue> asyncFuncObjHandle(thread, asyncFuncObj);
484 JSHandle<JSTaggedValue> valueHandle(thread, value);
485 return RuntimeStubs::RuntimeAsyncFunctionResolveOrReject(thread, asyncFuncObjHandle, valueHandle, is_resolve);
486 }
487
NewObjApply(JSThread * thread,JSTaggedValue func,JSTaggedValue array)488 JSTaggedValue SlowRuntimeStub::NewObjApply(JSThread *thread, JSTaggedValue func, JSTaggedValue array)
489 {
490 INTERPRETER_TRACE(thread, NewObjApply);
491 [[maybe_unused]] EcmaHandleScope handleScope(thread);
492
493 JSHandle<JSTaggedValue> funcHandle(thread, func);
494 JSHandle<JSTaggedValue> jsArray(thread, array);
495 return RuntimeStubs::RuntimeNewObjApply(thread, funcHandle, jsArray);
496 }
497
ThrowUndefinedIfHole(JSThread * thread,JSTaggedValue obj)498 void SlowRuntimeStub::ThrowUndefinedIfHole(JSThread *thread, JSTaggedValue obj)
499 {
500 INTERPRETER_TRACE(thread, ThrowUndefinedIfHole);
501 [[maybe_unused]] EcmaHandleScope handleScope(thread);
502
503 JSHandle<EcmaString> name(thread, obj);
504 return RuntimeStubs::RuntimeThrowUndefinedIfHole(thread, name);
505 }
506
ThrowIfSuperNotCorrectCall(JSThread * thread,uint16_t index,JSTaggedValue thisValue)507 JSTaggedValue SlowRuntimeStub::ThrowIfSuperNotCorrectCall(JSThread *thread, uint16_t index, JSTaggedValue thisValue)
508 {
509 INTERPRETER_TRACE(thread, ThrowIfSuperNotCorrectCall);
510 [[maybe_unused]] EcmaHandleScope handleScope(thread);
511
512 return RuntimeStubs::RuntimeThrowIfSuperNotCorrectCall(thread, index, thisValue);
513 }
514
ThrowIfNotObject(JSThread * thread)515 void SlowRuntimeStub::ThrowIfNotObject(JSThread *thread)
516 {
517 INTERPRETER_TRACE(thread, ThrowIfNotObject);
518 [[maybe_unused]] EcmaHandleScope handleScope(thread);
519
520 THROW_TYPE_ERROR(thread, "Inner return result is not object");
521 }
522
ThrowThrowNotExists(JSThread * thread)523 void SlowRuntimeStub::ThrowThrowNotExists(JSThread *thread)
524 {
525 INTERPRETER_TRACE(thread, ThrowThrowNotExists);
526 [[maybe_unused]] EcmaHandleScope handleScope(thread);
527
528 return RuntimeStubs::RuntimeThrowIfNotObject(thread);
529 }
530
ThrowPatternNonCoercible(JSThread * thread)531 void SlowRuntimeStub::ThrowPatternNonCoercible(JSThread *thread)
532 {
533 INTERPRETER_TRACE(thread, ThrowPatternNonCoercible);
534 [[maybe_unused]] EcmaHandleScope handleScope(thread);
535
536 return RuntimeStubs::RuntimeThrowPatternNonCoercible(thread);
537 }
538
StOwnByName(JSThread * thread,JSTaggedValue obj,JSTaggedValue prop,JSTaggedValue value)539 JSTaggedValue SlowRuntimeStub::StOwnByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, JSTaggedValue value)
540 {
541 INTERPRETER_TRACE(thread, StOwnByName);
542 [[maybe_unused]] EcmaHandleScope handleScope(thread);
543
544 JSHandle<JSTaggedValue> objHandle(thread, obj);
545 JSHandle<JSTaggedValue> propHandle(thread, prop);
546 JSHandle<JSTaggedValue> valueHandle(thread, value);
547 return RuntimeStubs::RuntimeStOwnByName(thread, objHandle, propHandle, valueHandle);
548 }
549
StOwnByNameWithNameSet(JSThread * thread,JSTaggedValue obj,JSTaggedValue prop,JSTaggedValue value)550 JSTaggedValue SlowRuntimeStub::StOwnByNameWithNameSet(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop,
551 JSTaggedValue value)
552 {
553 INTERPRETER_TRACE(thread, StOwnByName);
554 [[maybe_unused]] EcmaHandleScope handleScope(thread);
555
556 JSHandle<JSTaggedValue> objHandle(thread, obj);
557 JSHandle<JSTaggedValue> propHandle(thread, prop);
558 JSHandle<JSTaggedValue> valueHandle(thread, value);
559 return RuntimeStubs::RuntimeStOwnByNameWithNameSet(thread, objHandle, propHandle, valueHandle);
560 }
561
StOwnByIndex(JSThread * thread,JSTaggedValue obj,uint32_t idx,JSTaggedValue value)562 JSTaggedValue SlowRuntimeStub::StOwnByIndex(JSThread *thread, JSTaggedValue obj, uint32_t idx, JSTaggedValue value)
563 {
564 INTERPRETER_TRACE(thread, StOwnById);
565 [[maybe_unused]] EcmaHandleScope handleScope(thread);
566
567 JSHandle<JSTaggedValue> objHandle(thread, obj);
568 JSHandle<JSTaggedValue> idxHandle(thread, JSTaggedValue(idx));
569 JSHandle<JSTaggedValue> valueHandle(thread, value);
570 return RuntimeStubs::RuntimeStOwnByIndex(thread, objHandle, idxHandle, valueHandle);
571 }
572
StOwnByValue(JSThread * thread,JSTaggedValue obj,JSTaggedValue key,JSTaggedValue value)573 JSTaggedValue SlowRuntimeStub::StOwnByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue key, JSTaggedValue value)
574 {
575 INTERPRETER_TRACE(thread, StOwnByValue);
576 [[maybe_unused]] EcmaHandleScope handleScope(thread);
577
578 JSHandle<JSTaggedValue> objHandle(thread, obj);
579 JSHandle<JSTaggedValue> keyHandle(thread, key);
580 JSHandle<JSTaggedValue> valueHandle(thread, value);
581 return RuntimeStubs::RuntimeStOwnByValue(thread, objHandle, keyHandle, valueHandle);
582 }
583
StOwnByValueWithNameSet(JSThread * thread,JSTaggedValue obj,JSTaggedValue key,JSTaggedValue value)584 JSTaggedValue SlowRuntimeStub::StOwnByValueWithNameSet(JSThread *thread, JSTaggedValue obj, JSTaggedValue key,
585 JSTaggedValue value)
586 {
587 INTERPRETER_TRACE(thread, StOwnByValue);
588 [[maybe_unused]] EcmaHandleScope handleScope(thread);
589
590 JSHandle<JSTaggedValue> objHandle(thread, obj);
591 JSHandle<JSTaggedValue> keyHandle(thread, key);
592 JSHandle<JSTaggedValue> valueHandle(thread, value);
593 return RuntimeStubs::RuntimeStOwnByValueWithNameSet(thread, objHandle, keyHandle, valueHandle);
594 }
595
CreateEmptyArray(JSThread * thread,ObjectFactory * factory,JSHandle<GlobalEnv> globalEnv)596 JSTaggedValue SlowRuntimeStub::CreateEmptyArray(JSThread *thread, ObjectFactory *factory, JSHandle<GlobalEnv> globalEnv)
597 {
598 INTERPRETER_TRACE(thread, CreateEmptyArray);
599 [[maybe_unused]] EcmaHandleScope handleScope(thread);
600 return RuntimeStubs::RuntimeCreateEmptyArray(thread, factory, globalEnv);
601 }
602
CreateEmptyObject(JSThread * thread,ObjectFactory * factory,JSHandle<GlobalEnv> globalEnv)603 JSTaggedValue SlowRuntimeStub::CreateEmptyObject(JSThread *thread, ObjectFactory *factory,
604 JSHandle<GlobalEnv> globalEnv)
605 {
606 INTERPRETER_TRACE(thread, CreateEmptyObject);
607 [[maybe_unused]] EcmaHandleScope handleScope(thread);
608
609 return RuntimeStubs::RuntimeCreateEmptyObject(thread, factory, globalEnv);
610 }
611
CreateObjectWithBuffer(JSThread * thread,ObjectFactory * factory,JSObject * literal)612 JSTaggedValue SlowRuntimeStub::CreateObjectWithBuffer(JSThread *thread, ObjectFactory *factory, JSObject *literal)
613 {
614 INTERPRETER_TRACE(thread, CreateObjectWithBuffer);
615 [[maybe_unused]] EcmaHandleScope handleScope(thread);
616
617 JSHandle<JSObject> obj(thread, literal);
618 return RuntimeStubs::RuntimeCreateObjectWithBuffer(thread, factory, obj);
619 }
620
CreateObjectHavingMethod(JSThread * thread,ObjectFactory * factory,JSObject * literal,JSTaggedValue env)621 JSTaggedValue SlowRuntimeStub::CreateObjectHavingMethod(JSThread *thread, ObjectFactory *factory, JSObject *literal,
622 JSTaggedValue env)
623 {
624 INTERPRETER_TRACE(thread, CreateObjectHavingMethod);
625 [[maybe_unused]] EcmaHandleScope handleScope(thread);
626
627 JSHandle<JSObject> obj(thread, literal);
628 JSHandle<JSTaggedValue> envi(thread, env);
629 return RuntimeStubs::RuntimeCreateObjectHavingMethod(thread, factory, obj, envi);
630 }
631
SetObjectWithProto(JSThread * thread,JSTaggedValue proto,JSTaggedValue obj)632 JSTaggedValue SlowRuntimeStub::SetObjectWithProto(JSThread *thread, JSTaggedValue proto, JSTaggedValue obj)
633 {
634 INTERPRETER_TRACE(thread, SetObjectWithProto);
635 [[maybe_unused]] EcmaHandleScope handleScope(thread);
636
637 JSHandle<JSTaggedValue> protoHandle(thread, proto);
638 JSHandle<JSObject> objHandle(thread, obj);
639 return RuntimeStubs::RuntimeSetObjectWithProto(thread, protoHandle, objHandle);
640 }
641
IterNext(JSThread * thread,JSTaggedValue iter)642 JSTaggedValue SlowRuntimeStub::IterNext(JSThread *thread, JSTaggedValue iter)
643 {
644 INTERPRETER_TRACE(thread, IterNext);
645 [[maybe_unused]] EcmaHandleScope handleScope(thread);
646
647 JSHandle<JSTaggedValue> iterHandle(thread, iter);
648 return RuntimeStubs::RuntimeIterNext(thread, iterHandle);
649 }
650
CloseIterator(JSThread * thread,JSTaggedValue iter)651 JSTaggedValue SlowRuntimeStub::CloseIterator(JSThread *thread, JSTaggedValue iter)
652 {
653 INTERPRETER_TRACE(thread, CloseIterator);
654 [[maybe_unused]] EcmaHandleScope handleScope(thread);
655
656 JSHandle<JSTaggedValue> iterHandle(thread, iter);
657 return RuntimeStubs::RuntimeCloseIterator(thread, iterHandle);
658 }
659
StModuleVar(JSThread * thread,int32_t index,JSTaggedValue value)660 void SlowRuntimeStub::StModuleVar(JSThread *thread, int32_t index, JSTaggedValue value)
661 {
662 INTERPRETER_TRACE(thread, StModuleVar);
663 [[maybe_unused]] EcmaHandleScope scope(thread);
664
665 return RuntimeStubs::RuntimeStModuleVar(thread, index, value);
666 }
667
StModuleVar(JSThread * thread,JSTaggedValue key,JSTaggedValue value)668 void SlowRuntimeStub::StModuleVar(JSThread *thread, JSTaggedValue key, JSTaggedValue value)
669 {
670 INTERPRETER_TRACE(thread, StModuleVar);
671 [[maybe_unused]] EcmaHandleScope scope(thread);
672
673 return RuntimeStubs::RuntimeStModuleVar(thread, key, value);
674 }
675
LdLocalModuleVar(JSThread * thread,int32_t index)676 JSTaggedValue SlowRuntimeStub::LdLocalModuleVar(JSThread *thread, int32_t index)
677 {
678 RUNTIME_TRACE(thread, LdLocalModuleVarByIndex);
679 [[maybe_unused]] EcmaHandleScope scope(thread);
680
681 return RuntimeStubs::RuntimeLdLocalModuleVar(thread, index);
682 }
683
LdExternalModuleVar(JSThread * thread,int32_t index)684 JSTaggedValue SlowRuntimeStub::LdExternalModuleVar(JSThread *thread, int32_t index)
685 {
686 RUNTIME_TRACE(thread, LdExternalModuleVarByIndex);
687 [[maybe_unused]] EcmaHandleScope scope(thread);
688
689 return RuntimeStubs::RuntimeLdExternalModuleVar(thread, index);
690 }
691
LdModuleVar(JSThread * thread,JSTaggedValue key,bool inner)692 JSTaggedValue SlowRuntimeStub::LdModuleVar(JSThread *thread, JSTaggedValue key, bool inner)
693 {
694 INTERPRETER_TRACE(thread, LdModuleVar);
695 [[maybe_unused]] EcmaHandleScope scope(thread);
696
697 return RuntimeStubs::RuntimeLdModuleVar(thread, key, inner);
698 }
699
CreateRegExpWithLiteral(JSThread * thread,JSTaggedValue pattern,uint8_t flags)700 JSTaggedValue SlowRuntimeStub::CreateRegExpWithLiteral(JSThread *thread, JSTaggedValue pattern, uint8_t flags)
701 {
702 INTERPRETER_TRACE(thread, CreateRegExpWithLiteral);
703 [[maybe_unused]] EcmaHandleScope handleScope(thread);
704
705 JSHandle<JSTaggedValue> patternHandle(thread, pattern);
706 return RuntimeStubs::RuntimeCreateRegExpWithLiteral(thread, patternHandle, flags);
707 }
708
CreateArrayWithBuffer(JSThread * thread,ObjectFactory * factory,JSArray * literal)709 JSTaggedValue SlowRuntimeStub::CreateArrayWithBuffer(JSThread *thread, ObjectFactory *factory, JSArray *literal)
710 {
711 INTERPRETER_TRACE(thread, CreateArrayWithBuffer);
712 [[maybe_unused]] EcmaHandleScope handleScope(thread);
713
714 JSHandle<JSTaggedValue> array(thread, literal);
715 return RuntimeStubs::RuntimeCreateArrayWithBuffer(thread, factory, array);
716 }
717
GetTemplateObject(JSThread * thread,JSTaggedValue literal)718 JSTaggedValue SlowRuntimeStub::GetTemplateObject(JSThread *thread, JSTaggedValue literal)
719 {
720 INTERPRETER_TRACE(thread, GetTemplateObject);
721 [[maybe_unused]] EcmaHandleScope handleScope(thread);
722
723 JSHandle<JSTaggedValue> templateLiteral(thread, literal);
724 return RuntimeStubs::RuntimeGetTemplateObject(thread, templateLiteral);
725 }
726
GetNextPropName(JSThread * thread,JSTaggedValue iter)727 JSTaggedValue SlowRuntimeStub::GetNextPropName(JSThread *thread, JSTaggedValue iter)
728 {
729 INTERPRETER_TRACE(thread, GetNextPropName);
730 [[maybe_unused]] EcmaHandleScope handleScope(thread);
731
732 JSHandle<JSTaggedValue> iterator(thread, iter);
733 return RuntimeStubs::RuntimeGetNextPropName(thread, iterator);
734 }
735
CopyDataProperties(JSThread * thread,JSTaggedValue dst,JSTaggedValue src)736 JSTaggedValue SlowRuntimeStub::CopyDataProperties(JSThread *thread, JSTaggedValue dst, JSTaggedValue src)
737 {
738 INTERPRETER_TRACE(thread, CopyDataProperties);
739 [[maybe_unused]] EcmaHandleScope handleScope(thread);
740
741 JSHandle<JSTaggedValue> dstHandle(thread, dst);
742 JSHandle<JSTaggedValue> srcHandle(thread, src);
743 return RuntimeStubs::RuntimeCopyDataProperties(thread, dstHandle, srcHandle);
744 }
745
GetIteratorNext(JSThread * thread,JSTaggedValue obj,JSTaggedValue method)746 JSTaggedValue SlowRuntimeStub::GetIteratorNext(JSThread *thread, JSTaggedValue obj, JSTaggedValue method)
747 {
748 RUNTIME_TRACE(thread, GetIteratorNext);
749 [[maybe_unused]] EcmaHandleScope handleScope(thread);
750
751 JSHandle<JSTaggedValue> iter(thread, obj);
752 JSHandle<JSTaggedValue> next(thread, method);
753 return RuntimeStubs::RuntimeGetIteratorNext(thread, iter, next);
754 }
755
GetUnmapedArgs(JSThread * thread,JSTaggedType * sp,uint32_t actualNumArgs,uint32_t startIdx)756 JSTaggedValue SlowRuntimeStub::GetUnmapedArgs(JSThread *thread, JSTaggedType *sp, uint32_t actualNumArgs,
757 uint32_t startIdx)
758 {
759 INTERPRETER_TRACE(thread, GetUnmapedArgs);
760 [[maybe_unused]] EcmaHandleScope handleScope(thread);
761 return RuntimeStubs::RuntimeGetUnmapedArgs(thread, sp, actualNumArgs, startIdx);
762 }
763
CopyRestArgs(JSThread * thread,JSTaggedType * sp,uint32_t restNumArgs,uint32_t startIdx)764 JSTaggedValue SlowRuntimeStub::CopyRestArgs(JSThread *thread, JSTaggedType *sp, uint32_t restNumArgs, uint32_t startIdx)
765 {
766 INTERPRETER_TRACE(thread, Copyrestargs);
767 [[maybe_unused]] EcmaHandleScope handleScope(thread);
768 return RuntimeStubs::RuntimeCopyRestArgs(thread, sp, restNumArgs, startIdx);
769 }
770
GetIterator(JSThread * thread,JSTaggedValue obj)771 JSTaggedValue SlowRuntimeStub::GetIterator(JSThread *thread, JSTaggedValue obj)
772 {
773 INTERPRETER_TRACE(thread, GetIterator);
774 [[maybe_unused]] EcmaHandleScope handleScope(thread);
775
776 JSHandle<JSTaggedValue> objHandle(thread, obj);
777 return RuntimeStubs::RuntimeGetIterator(thread, objHandle);
778 }
779
GetAsyncIterator(JSThread * thread,JSTaggedValue obj)780 JSTaggedValue SlowRuntimeStub::GetAsyncIterator(JSThread *thread, JSTaggedValue obj)
781 {
782 INTERPRETER_TRACE(thread, GetAsyncIterator);
783 [[maybe_unused]] EcmaHandleScope handleScope(thread);
784
785 JSHandle<JSTaggedValue> objHandle(thread, obj);
786 return RuntimeStubs::RuntimeGetAsyncIterator(thread, objHandle);
787 }
788
DefineGetterSetterByValue(JSThread * thread,JSTaggedValue obj,JSTaggedValue prop,JSTaggedValue getter,JSTaggedValue setter,bool flag)789 JSTaggedValue SlowRuntimeStub::DefineGetterSetterByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop,
790 JSTaggedValue getter, JSTaggedValue setter, bool flag)
791 {
792 INTERPRETER_TRACE(thread, DefineGetterSetterByValue);
793 [[maybe_unused]] EcmaHandleScope handleScope(thread);
794
795 JSHandle<JSObject> objHandle(thread, obj);
796 JSHandle<JSTaggedValue> propHandle(thread, prop);
797 JSHandle<JSTaggedValue> getterHandle(thread, getter);
798 JSHandle<JSTaggedValue> setterHandle(thread, setter);
799 JSHandle<JSTaggedValue> func(thread, JSTaggedValue::Undefined());
800 return RuntimeStubs::RuntimeDefineGetterSetterByValue(thread, objHandle, propHandle,
801 getterHandle, setterHandle, flag,
802 func, 0);
803 }
804
LdObjByIndex(JSThread * thread,JSTaggedValue obj,uint32_t idx,bool callGetter,JSTaggedValue receiver)805 JSTaggedValue SlowRuntimeStub::LdObjByIndex(JSThread *thread, JSTaggedValue obj, uint32_t idx, bool callGetter,
806 JSTaggedValue receiver)
807 {
808 INTERPRETER_TRACE(thread, LdObjByIndex);
809 [[maybe_unused]] EcmaHandleScope handleScope(thread);
810
811 JSHandle<JSTaggedValue> objHandle(thread, obj);
812 return RuntimeStubs::RuntimeLdObjByIndex(thread, objHandle, idx, callGetter, receiver);
813 }
814
StObjByIndex(JSThread * thread,JSTaggedValue obj,uint32_t idx,JSTaggedValue value)815 JSTaggedValue SlowRuntimeStub::StObjByIndex(JSThread *thread, JSTaggedValue obj, uint32_t idx, JSTaggedValue value)
816 {
817 INTERPRETER_TRACE(thread, StObjByIndex);
818 [[maybe_unused]] EcmaHandleScope handleScope(thread);
819
820 JSHandle<JSTaggedValue> objHandle(thread, obj);
821 JSHandle<JSTaggedValue> valueHandle(thread, value);
822 return RuntimeStubs::RuntimeStObjByIndex(thread, objHandle, idx, valueHandle);
823 }
824
LdObjByName(JSThread * thread,JSTaggedValue obj,JSTaggedValue prop,bool callGetter,JSTaggedValue receiver)825 JSTaggedValue SlowRuntimeStub::LdObjByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, bool callGetter,
826 JSTaggedValue receiver)
827 {
828 INTERPRETER_TRACE(thread, LdObjByName);
829 [[maybe_unused]] EcmaHandleScope handleScope(thread);
830 return RuntimeStubs::RuntimeLdObjByName(thread, obj, prop, callGetter, receiver);
831 }
832
StObjByName(JSThread * thread,JSTaggedValue obj,JSTaggedValue prop,JSTaggedValue value)833 JSTaggedValue SlowRuntimeStub::StObjByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, JSTaggedValue value)
834 {
835 INTERPRETER_TRACE(thread, StObjByName);
836 [[maybe_unused]] EcmaHandleScope handleScope(thread);
837
838 JSHandle<JSTaggedValue> objHandle(thread, obj);
839 JSHandle<JSTaggedValue> propHandle(thread, prop);
840 JSHandle<JSTaggedValue> valueHandle(thread, value);
841 return RuntimeStubs::RuntimeStObjByName(thread, objHandle, propHandle, valueHandle);
842 }
843
LdObjByValue(JSThread * thread,JSTaggedValue obj,JSTaggedValue prop,bool callGetter,JSTaggedValue receiver)844 JSTaggedValue SlowRuntimeStub::LdObjByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, bool callGetter,
845 JSTaggedValue receiver)
846 {
847 INTERPRETER_TRACE(thread, LdObjByValue);
848 [[maybe_unused]] EcmaHandleScope handleScope(thread);
849
850 JSHandle<JSTaggedValue> objHandle(thread, obj);
851 JSHandle<JSTaggedValue> propHandle(thread, prop);
852 return RuntimeStubs::RuntimeLdObjByValue(thread, objHandle, propHandle, callGetter, receiver);
853 }
854
StObjByValue(JSThread * thread,JSTaggedValue obj,JSTaggedValue prop,JSTaggedValue value)855 JSTaggedValue SlowRuntimeStub::StObjByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop,
856 JSTaggedValue value)
857 {
858 INTERPRETER_TRACE(thread, StObjByValue);
859 [[maybe_unused]] EcmaHandleScope handleScope(thread);
860
861 JSHandle<JSTaggedValue> objHandle(thread, obj);
862 JSHandle<JSTaggedValue> propHandle(thread, prop);
863 JSHandle<JSTaggedValue> valueHandle(thread, value);
864 return RuntimeStubs::RuntimeStObjByValue(thread, objHandle, propHandle, valueHandle);
865 }
866
TryLdGlobalByNameFromGlobalProto(JSThread * thread,JSTaggedValue global,JSTaggedValue prop)867 JSTaggedValue SlowRuntimeStub::TryLdGlobalByNameFromGlobalProto(JSThread *thread, JSTaggedValue global,
868 JSTaggedValue prop)
869 {
870 INTERPRETER_TRACE(thread, Trygetobjprop);
871 [[maybe_unused]] EcmaHandleScope handleScope(thread);
872
873 JSHandle<JSTaggedValue> obj(thread, global.GetTaggedObject()->GetClass()->GetPrototype());
874 JSHandle<JSTaggedValue> propHandle(thread, prop);
875 return RuntimeStubs::RuntimeTryLdGlobalByName(thread, obj, propHandle);
876 }
877
TryStGlobalByName(JSThread * thread,JSTaggedValue prop)878 JSTaggedValue SlowRuntimeStub::TryStGlobalByName(JSThread *thread, JSTaggedValue prop)
879 {
880 INTERPRETER_TRACE(thread, TryStGlobalByName);
881 // If fast path is fail, not need slow path, just throw error.
882 return ThrowReferenceError(thread, prop, " is not defined");
883 }
884
LdGlobalVarFromGlobalProto(JSThread * thread,JSTaggedValue global,JSTaggedValue prop)885 JSTaggedValue SlowRuntimeStub::LdGlobalVarFromGlobalProto(JSThread *thread, JSTaggedValue global, JSTaggedValue prop)
886 {
887 INTERPRETER_TRACE(thread, LdGlobalVar);
888 [[maybe_unused]] EcmaHandleScope handleScope(thread);
889
890 JSHandle<JSTaggedValue> objHandle(thread, global);
891 JSHandle<JSTaggedValue> propHandle(thread, prop);
892 return RuntimeStubs::RuntimeLdGlobalVarFromProto(thread, objHandle, propHandle); // After checked global itself.
893 }
894
StGlobalVar(JSThread * thread,JSTaggedValue prop,JSTaggedValue value)895 JSTaggedValue SlowRuntimeStub::StGlobalVar(JSThread *thread, JSTaggedValue prop, JSTaggedValue value)
896 {
897 INTERPRETER_TRACE(thread, StGlobalVar);
898 [[maybe_unused]] EcmaHandleScope handleScope(thread);
899
900 JSHandle<JSTaggedValue> propHandle(thread, prop);
901 JSHandle<JSTaggedValue> valueHandle(thread, value);
902 return RuntimeStubs::RuntimeStGlobalVar(thread, propHandle, valueHandle);
903 }
904
TryUpdateGlobalRecord(JSThread * thread,JSTaggedValue prop,JSTaggedValue value)905 JSTaggedValue SlowRuntimeStub::TryUpdateGlobalRecord(JSThread *thread, JSTaggedValue prop, JSTaggedValue value)
906 {
907 INTERPRETER_TRACE(thread, TryUpdateGlobalRecord);
908 [[maybe_unused]] EcmaHandleScope handleScope(thread);
909
910 return RuntimeStubs::RuntimeTryUpdateGlobalRecord(thread, prop, value);
911 }
912
913 // return box
LdGlobalRecord(JSThread * thread,JSTaggedValue key)914 JSTaggedValue SlowRuntimeStub::LdGlobalRecord(JSThread *thread, JSTaggedValue key)
915 {
916 INTERPRETER_TRACE(thread, LdGlobalRecord);
917 [[maybe_unused]] EcmaHandleScope handleScope(thread);
918
919 return RuntimeStubs::RuntimeLdGlobalRecord(thread, key);
920 }
921
StGlobalRecord(JSThread * thread,JSTaggedValue prop,JSTaggedValue value,bool isConst)922 JSTaggedValue SlowRuntimeStub::StGlobalRecord(JSThread *thread, JSTaggedValue prop, JSTaggedValue value, bool isConst)
923 {
924 INTERPRETER_TRACE(thread, StGlobalRecord);
925 [[maybe_unused]] EcmaHandleScope handleScope(thread);
926
927 JSHandle<JSTaggedValue> propHandle(thread, prop);
928 JSHandle<JSTaggedValue> valueHandle(thread, value);
929 return RuntimeStubs::RuntimeStGlobalRecord(thread, propHandle, valueHandle, isConst);
930 }
931
ThrowReferenceError(JSThread * thread,JSTaggedValue prop,const char * desc)932 JSTaggedValue SlowRuntimeStub::ThrowReferenceError(JSThread *thread, JSTaggedValue prop, const char *desc)
933 {
934 INTERPRETER_TRACE(thread, ThrowReferenceError);
935 [[maybe_unused]] EcmaHandleScope handleScope(thread);
936
937 JSHandle<JSTaggedValue> propHandle(thread, prop);
938 return RuntimeStubs::RuntimeThrowReferenceError(thread, propHandle, desc);
939 }
940
ThrowTypeError(JSThread * thread,const char * message)941 JSTaggedValue SlowRuntimeStub::ThrowTypeError(JSThread *thread, const char *message)
942 {
943 INTERPRETER_TRACE(thread, ThrowTypeError);
944 [[maybe_unused]] EcmaHandleScope handleScope(thread);
945
946 return RuntimeStubs::RuntimeThrowTypeError(thread, message);
947 }
948
ThrowSyntaxError(JSThread * thread,const char * message)949 JSTaggedValue SlowRuntimeStub::ThrowSyntaxError(JSThread *thread, const char *message)
950 {
951 INTERPRETER_TRACE(thread, ThrowSyntaxError);
952 [[maybe_unused]] EcmaHandleScope handleScope(thread);
953
954 return RuntimeStubs::RuntimeThrowSyntaxError(thread, message);
955 }
956
StArraySpread(JSThread * thread,JSTaggedValue dst,JSTaggedValue index,JSTaggedValue src)957 JSTaggedValue SlowRuntimeStub::StArraySpread(JSThread *thread, JSTaggedValue dst, JSTaggedValue index,
958 JSTaggedValue src)
959 {
960 INTERPRETER_TRACE(thread, StArraySpread);
961 [[maybe_unused]] EcmaHandleScope handleScope(thread);
962
963 JSHandle<JSTaggedValue> dstHandle(thread, dst);
964 JSHandle<JSTaggedValue> srcHandle(thread, src);
965 return RuntimeStubs::RuntimeStArraySpread(thread, dstHandle, index, srcHandle);
966 }
967
DefineFunc(JSThread * thread,JSTaggedValue constPool,uint16_t methodId,JSTaggedValue module,uint16_t length,JSTaggedValue env,JSTaggedValue homeObject)968 JSTaggedValue SlowRuntimeStub::DefineFunc(JSThread *thread, JSTaggedValue constPool, uint16_t methodId,
969 JSTaggedValue module, uint16_t length, JSTaggedValue env,
970 JSTaggedValue homeObject)
971 {
972 INTERPRETER_TRACE(thread, DefineFunc);
973 [[maybe_unused]] EcmaHandleScope handleScope(thread);
974 JSHandle<JSTaggedValue> constpoolHandle(thread, constPool);
975 JSHandle<JSTaggedValue> moduleHandle(thread, module);
976 JSHandle<JSTaggedValue> envHandle(thread, env);
977 JSHandle<JSTaggedValue> homeObjectHandle(thread, homeObject);
978 return RuntimeStubs::RuntimeDefinefunc(thread, constpoolHandle, methodId, moduleHandle,
979 length, envHandle, homeObjectHandle);
980 }
981
GetSuperConstructor(JSThread * thread,JSTaggedValue ctor)982 JSTaggedValue SlowRuntimeStub::GetSuperConstructor(JSThread *thread, JSTaggedValue ctor)
983 {
984 INTERPRETER_TRACE(thread, GetSuperConstructor);
985 JSHandle<JSTaggedValue> ctorHandle(thread, ctor);
986 JSHandle<JSTaggedValue> superConstructor(thread, JSTaggedValue::GetPrototype(thread, ctorHandle));
987 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
988 return superConstructor.GetTaggedValue();
989 }
990
SuperCall(JSThread * thread,JSTaggedValue func,JSTaggedValue newTarget,uint16_t firstVRegIdx,uint16_t length)991 JSTaggedValue SlowRuntimeStub::SuperCall(JSThread *thread, JSTaggedValue func, JSTaggedValue newTarget,
992 uint16_t firstVRegIdx, uint16_t length)
993 {
994 INTERPRETER_TRACE(thread, SuperCall);
995 [[maybe_unused]] EcmaHandleScope handleScope(thread);
996
997 JSHandle<JSTaggedValue> funcHandle(thread, func);
998 JSHandle<JSTaggedValue> newTargetHandle(thread, newTarget);
999 return RuntimeStubs::RuntimeSuperCall(thread, funcHandle, newTargetHandle, firstVRegIdx, length);
1000 }
1001
DynamicImport(JSThread * thread,JSTaggedValue specifier,JSTaggedValue currentFunc)1002 JSTaggedValue SlowRuntimeStub::DynamicImport(JSThread *thread, JSTaggedValue specifier, JSTaggedValue currentFunc)
1003 {
1004 INTERPRETER_TRACE(thread, DynamicImport);
1005 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1006
1007 JSHandle<JSTaggedValue> specifierHandle(thread, specifier);
1008 JSHandle<JSTaggedValue> currentFuncHandle(thread, currentFunc);
1009 return RuntimeStubs::RuntimeDynamicImport(thread, specifierHandle, currentFuncHandle);
1010 }
1011
SuperCallSpread(JSThread * thread,JSTaggedValue func,JSTaggedValue newTarget,JSTaggedValue array)1012 JSTaggedValue SlowRuntimeStub::SuperCallSpread(JSThread *thread, JSTaggedValue func, JSTaggedValue newTarget,
1013 JSTaggedValue array)
1014 {
1015 INTERPRETER_TRACE(thread, SuperCallSpread);
1016 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1017
1018 JSHandle<JSTaggedValue> funcHandle(thread, func);
1019 JSHandle<JSTaggedValue> newTargetHandle(thread, newTarget);
1020 JSHandle<JSTaggedValue> jsArray(thread, array);
1021 return RuntimeStubs::RuntimeSuperCallSpread(thread, funcHandle, newTargetHandle, jsArray);
1022 }
1023
DefineMethod(JSThread * thread,Method * method,JSTaggedValue homeObject,uint16_t length,JSTaggedValue env)1024 JSTaggedValue SlowRuntimeStub::DefineMethod(JSThread *thread, Method *method, JSTaggedValue homeObject,
1025 uint16_t length, JSTaggedValue env)
1026 {
1027 INTERPRETER_TRACE(thread, DefineMethod);
1028 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1029 JSHandle<Method> methodHandle(thread, method);
1030 JSHandle<JSTaggedValue> homeObjectHandle(thread, homeObject);
1031 JSHandle<JSTaggedValue> envHandle(thread, env);
1032 return RuntimeStubs::RuntimeDefineMethod(thread, methodHandle, homeObjectHandle, length, envHandle);
1033 }
1034
LdSendableClass(JSThread * thread,JSTaggedValue env,uint16_t level)1035 JSTaggedValue SlowRuntimeStub::LdSendableClass(JSThread *thread, JSTaggedValue env, uint16_t level)
1036 {
1037 INTERPRETER_TRACE(thread, LdSendableClass);
1038 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1039 JSHandle<JSTaggedValue> envHandle(thread, env);
1040 return RuntimeStubs::RuntimeLdSendableClass(envHandle, level);
1041 }
1042
LdSuperByValue(JSThread * thread,JSTaggedValue obj,JSTaggedValue key,JSTaggedValue thisFunc)1043 JSTaggedValue SlowRuntimeStub::LdSuperByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue key,
1044 JSTaggedValue thisFunc)
1045 {
1046 INTERPRETER_TRACE(thread, LdSuperByValue);
1047 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1048
1049 JSHandle<JSTaggedValue> objHandle(thread, obj);
1050 JSHandle<JSTaggedValue> propHandle(thread, key);
1051 return RuntimeStubs::RuntimeLdSuperByValue(thread, objHandle, propHandle, thisFunc);
1052 }
1053
StSuperByValue(JSThread * thread,JSTaggedValue obj,JSTaggedValue key,JSTaggedValue value,JSTaggedValue thisFunc)1054 JSTaggedValue SlowRuntimeStub::StSuperByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue key,
1055 JSTaggedValue value, JSTaggedValue thisFunc)
1056 {
1057 INTERPRETER_TRACE(thread, StSuperByValue);
1058 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1059
1060 JSHandle<JSTaggedValue> objHandle(thread, obj);
1061 JSHandle<JSTaggedValue> propHandle(thread, key);
1062 JSHandle<JSTaggedValue> valueHandle(thread, value);
1063 return RuntimeStubs::RuntimeStSuperByValue(thread, objHandle, propHandle, valueHandle, thisFunc);
1064 }
1065
GetCallSpreadArgs(JSThread * thread,JSTaggedValue array)1066 JSTaggedValue SlowRuntimeStub::GetCallSpreadArgs(JSThread *thread, JSTaggedValue array)
1067 {
1068 INTERPRETER_TRACE(thread, GetCallSpreadArgs);
1069 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1070
1071 JSHandle<JSTaggedValue> jsArray(thread, array);
1072 return RuntimeStubs::RuntimeGetCallSpreadArgs(thread, jsArray);
1073 }
1074
ThrowDeleteSuperProperty(JSThread * thread)1075 void SlowRuntimeStub::ThrowDeleteSuperProperty(JSThread *thread)
1076 {
1077 INTERPRETER_TRACE(thread, ThrowDeleteSuperProperty);
1078 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1079
1080 return RuntimeStubs::RuntimeThrowDeleteSuperProperty(thread);
1081 }
1082
NotifyInlineCache(JSThread * thread,Method * method)1083 JSTaggedValue SlowRuntimeStub::NotifyInlineCache(JSThread *thread, Method *method)
1084 {
1085 INTERPRETER_TRACE(thread, NotifyInlineCache);
1086 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1087
1088 JSHandle<Method> methodHandle(thread, method);
1089 uint32_t slotSize = methodHandle->GetSlotSize();
1090 return RuntimeStubs::RuntimeNotifyInlineCache(thread, methodHandle, slotSize);
1091 }
1092
ResolveClass(JSThread * thread,JSTaggedValue ctor,TaggedArray * literal,JSTaggedValue base,JSTaggedValue lexenv)1093 JSTaggedValue SlowRuntimeStub::ResolveClass(JSThread *thread, JSTaggedValue ctor, TaggedArray *literal,
1094 JSTaggedValue base, JSTaggedValue lexenv)
1095 {
1096 JSHandle<JSFunction> cls(thread, ctor);
1097 JSHandle<TaggedArray> literalBuffer(thread, literal);
1098 JSHandle<JSTaggedValue> baseHandle(thread, base);
1099 JSHandle<JSTaggedValue> lexicalEnv(thread, lexenv);
1100 return RuntimeStubs::RuntimeResolveClass(thread, cls, literalBuffer, baseHandle, lexicalEnv);
1101 }
1102
1103 // clone class may need re-set inheritance relationship due to extends may be a variable.
CloneClassFromTemplate(JSThread * thread,JSTaggedValue ctor,JSTaggedValue base,JSTaggedValue lexenv)1104 JSTaggedValue SlowRuntimeStub::CloneClassFromTemplate(JSThread *thread, JSTaggedValue ctor, JSTaggedValue base,
1105 JSTaggedValue lexenv)
1106 {
1107 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1108
1109 JSHandle<JSTaggedValue> lexenvHandle(thread, lexenv);
1110 JSHandle<JSTaggedValue> baseHandle(thread, base);
1111 JSHandle<JSFunction> cls(thread, ctor);
1112 return RuntimeStubs::RuntimeCloneClassFromTemplate(thread, cls, baseHandle, lexenvHandle);
1113 }
1114
1115 // clone class may need re-set inheritance relationship due to extends may be a variable.
CreateClassWithBuffer(JSThread * thread,JSTaggedValue base,JSTaggedValue lexenv,JSTaggedValue constpool,uint16_t methodId,uint16_t literalId,JSTaggedValue module,JSTaggedValue length)1116 JSTaggedValue SlowRuntimeStub::CreateClassWithBuffer(JSThread *thread, JSTaggedValue base,
1117 JSTaggedValue lexenv, JSTaggedValue constpool,
1118 uint16_t methodId, uint16_t literalId, JSTaggedValue module,
1119 JSTaggedValue length)
1120 {
1121 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1122 JSHandle<JSTaggedValue> baseHandle(thread, base);
1123 JSHandle<JSTaggedValue> lexenvHandle(thread, lexenv);
1124 JSHandle<JSTaggedValue> constpoolHandle(thread, constpool);
1125 JSHandle<JSTaggedValue> moduleHandle(thread, module);
1126 JSHandle<JSTaggedValue> lengthHandle(thread, length);
1127 return RuntimeStubs::RuntimeCreateClassWithBuffer(thread, baseHandle, lexenvHandle,
1128 constpoolHandle, methodId, literalId,
1129 moduleHandle, lengthHandle);
1130 }
1131
CreateSharedClass(JSThread * thread,JSTaggedValue base,JSTaggedValue constpool,uint16_t methodId,uint16_t literalId,uint16_t length,JSTaggedValue module)1132 JSTaggedValue SlowRuntimeStub::CreateSharedClass(JSThread *thread, JSTaggedValue base,
1133 JSTaggedValue constpool, uint16_t methodId, uint16_t literalId,
1134 uint16_t length, JSTaggedValue module)
1135 {
1136 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1137 JSHandle<JSTaggedValue> baseHandle(thread, base);
1138 JSHandle<JSTaggedValue> constpoolHandle(thread, constpool);
1139 JSHandle<JSTaggedValue> moduleHandle(thread, module);
1140 return RuntimeStubs::RuntimeCreateSharedClass(thread, baseHandle, constpoolHandle, methodId,
1141 literalId, length, moduleHandle);
1142 }
1143
SetClassInheritanceRelationship(JSThread * thread,JSTaggedValue ctor,JSTaggedValue base)1144 JSTaggedValue SlowRuntimeStub::SetClassInheritanceRelationship(JSThread *thread, JSTaggedValue ctor, JSTaggedValue base)
1145 {
1146 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1147
1148 JSHandle<JSTaggedValue> cls(thread, ctor);
1149 JSHandle<JSTaggedValue> parent(thread, base);
1150 return RuntimeStubs::RuntimeSetClassInheritanceRelationship(thread, cls, parent);
1151 }
1152
SetClassConstructorLength(JSThread * thread,JSTaggedValue ctor,JSTaggedValue length)1153 JSTaggedValue SlowRuntimeStub::SetClassConstructorLength(JSThread *thread, JSTaggedValue ctor, JSTaggedValue length)
1154 {
1155 return RuntimeStubs::RuntimeSetClassConstructorLength(thread, ctor, length);
1156 }
1157
GetModuleNamespace(JSThread * thread,int32_t index)1158 JSTaggedValue SlowRuntimeStub::GetModuleNamespace(JSThread *thread, int32_t index)
1159 {
1160 return RuntimeStubs::RuntimeGetModuleNamespace(thread, index);
1161 }
1162
GetModuleNamespace(JSThread * thread,JSTaggedValue localName)1163 JSTaggedValue SlowRuntimeStub::GetModuleNamespace(JSThread *thread, JSTaggedValue localName)
1164 {
1165 return RuntimeStubs::RuntimeGetModuleNamespace(thread, localName);
1166 }
1167
LdBigInt(JSThread * thread,JSTaggedValue numberBigInt)1168 JSTaggedValue SlowRuntimeStub::LdBigInt(JSThread *thread, JSTaggedValue numberBigInt)
1169 {
1170 INTERPRETER_TRACE(thread, LdBigInt);
1171 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1172 JSHandle<JSTaggedValue> bigint(thread, numberBigInt);
1173 return RuntimeStubs::RuntimeLdBigInt(thread, bigint);
1174 }
AsyncGeneratorResolve(JSThread * thread,JSTaggedValue asyncFuncObj,const JSTaggedValue value,JSTaggedValue flag)1175 JSTaggedValue SlowRuntimeStub::AsyncGeneratorResolve(JSThread *thread, JSTaggedValue asyncFuncObj,
1176 const JSTaggedValue value, JSTaggedValue flag)
1177 {
1178 INTERPRETER_TRACE(thread, AsyncGeneratorResolve);
1179 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1180
1181 JSHandle<JSTaggedValue> genObjHandle(thread, asyncFuncObj);
1182 JSHandle<JSTaggedValue> valueHandle(thread, value);
1183
1184 return RuntimeStubs::RuntimeAsyncGeneratorResolve(thread, genObjHandle, valueHandle, flag);
1185 }
1186
AsyncGeneratorReject(JSThread * thread,JSTaggedValue asyncFuncObj,const JSTaggedValue value)1187 JSTaggedValue SlowRuntimeStub::AsyncGeneratorReject(JSThread *thread, JSTaggedValue asyncFuncObj,
1188 const JSTaggedValue value)
1189 {
1190 INTERPRETER_TRACE(thread, AsyncGeneratorReject);
1191 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1192
1193 JSHandle<JSAsyncGeneratorObject> asyncFuncObjHandle(thread, asyncFuncObj);
1194 JSHandle<JSTaggedValue> valueHandle(thread, value);
1195
1196 return JSAsyncGeneratorObject::AsyncGeneratorReject(thread, asyncFuncObjHandle, valueHandle);
1197 }
1198
LdPatchVar(JSThread * thread,uint32_t index)1199 JSTaggedValue SlowRuntimeStub::LdPatchVar(JSThread *thread, uint32_t index)
1200 {
1201 INTERPRETER_TRACE(thread, LdPatchVar);
1202 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1203
1204 return RuntimeStubs::RuntimeLdPatchVar(thread, index);
1205 }
1206
StPatchVar(JSThread * thread,uint32_t index,JSTaggedValue value)1207 JSTaggedValue SlowRuntimeStub::StPatchVar(JSThread *thread, uint32_t index, JSTaggedValue value)
1208 {
1209 INTERPRETER_TRACE(thread, StPatchVar);
1210 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1211
1212 JSHandle<JSTaggedValue> valueHandle(thread, value);
1213 return RuntimeStubs::RuntimeStPatchVar(thread, index, valueHandle);
1214 }
1215
NotifyConcurrentResult(JSThread * thread,JSTaggedValue result,JSTaggedValue hint)1216 JSTaggedValue SlowRuntimeStub::NotifyConcurrentResult(JSThread *thread, JSTaggedValue result, JSTaggedValue hint)
1217 {
1218 INTERPRETER_TRACE(thread, NotifyConcurrentResult);
1219 return RuntimeStubs::RuntimeNotifyConcurrentResult(thread, result, hint);
1220 }
1221
UpdateAOTHClass(JSThread * thread,JSTaggedValue jshclass,JSTaggedValue newjshclass,JSTaggedValue key)1222 JSTaggedValue SlowRuntimeStub::UpdateAOTHClass(JSThread *thread, JSTaggedValue jshclass,
1223 JSTaggedValue newjshclass, JSTaggedValue key)
1224 {
1225 INTERPRETER_TRACE(thread, UpdateAOTHClass);
1226 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1227 JSHandle<JSHClass> oldhclass(thread, jshclass);
1228 JSHandle<JSHClass> newhclass(thread, newjshclass);
1229 return RuntimeStubs::RuntimeUpdateAOTHClass(thread, oldhclass, newhclass, key);
1230 }
1231
DefineField(JSThread * thread,JSTaggedValue obj,JSTaggedValue propKey,JSTaggedValue value)1232 JSTaggedValue SlowRuntimeStub::DefineField(JSThread *thread, JSTaggedValue obj,
1233 JSTaggedValue propKey, JSTaggedValue value)
1234 {
1235 INTERPRETER_TRACE(thread, DefineField);
1236 return RuntimeStubs::RuntimeDefineField(thread, obj, propKey, value);
1237 }
1238
CreatePrivateProperty(JSThread * thread,JSTaggedValue lexicalEnv,uint32_t count,JSTaggedValue constpool,uint32_t literalId,JSTaggedValue module)1239 JSTaggedValue SlowRuntimeStub::CreatePrivateProperty(JSThread *thread, JSTaggedValue lexicalEnv,
1240 uint32_t count, JSTaggedValue constpool, uint32_t literalId, JSTaggedValue module)
1241 {
1242 INTERPRETER_TRACE(thread, CreatePrivateProperty);
1243 return RuntimeStubs::RuntimeCreatePrivateProperty(thread, lexicalEnv, count, constpool, literalId, module);
1244 }
1245
DefinePrivateProperty(JSThread * thread,JSTaggedValue lexicalEnv,uint32_t levelIndex,uint32_t slotIndex,JSTaggedValue obj,JSTaggedValue value)1246 JSTaggedValue SlowRuntimeStub::DefinePrivateProperty(JSThread *thread, JSTaggedValue lexicalEnv,
1247 uint32_t levelIndex, uint32_t slotIndex, JSTaggedValue obj, JSTaggedValue value)
1248 {
1249 INTERPRETER_TRACE(thread, DefinePrivateProperty);
1250 return RuntimeStubs::RuntimeDefinePrivateProperty(thread, lexicalEnv, levelIndex, slotIndex, obj, value);
1251 }
1252
LdPrivateProperty(JSThread * thread,JSTaggedValue lexicalEnv,uint32_t levelIndex,uint32_t slotIndex,JSTaggedValue obj)1253 JSTaggedValue SlowRuntimeStub::LdPrivateProperty(JSThread *thread, JSTaggedValue lexicalEnv,
1254 uint32_t levelIndex, uint32_t slotIndex, JSTaggedValue obj)
1255 {
1256 INTERPRETER_TRACE(thread, LdPrivateProperty);
1257 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1258 return RuntimeStubs::RuntimeLdPrivateProperty(thread, lexicalEnv, levelIndex, slotIndex, obj);
1259 }
1260
StPrivateProperty(JSThread * thread,JSTaggedValue lexicalEnv,uint32_t levelIndex,uint32_t slotIndex,JSTaggedValue obj,JSTaggedValue value)1261 JSTaggedValue SlowRuntimeStub::StPrivateProperty(JSThread *thread, JSTaggedValue lexicalEnv,
1262 uint32_t levelIndex, uint32_t slotIndex, JSTaggedValue obj, JSTaggedValue value)
1263 {
1264 INTERPRETER_TRACE(thread, StPrivateProperty);
1265 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1266 return RuntimeStubs::RuntimeStPrivateProperty(thread, lexicalEnv, levelIndex, slotIndex, obj, value);
1267 }
1268
TestIn(JSThread * thread,JSTaggedValue lexicalEnv,uint32_t levelIndex,uint32_t slotIndex,JSTaggedValue obj)1269 JSTaggedValue SlowRuntimeStub::TestIn(JSThread *thread, JSTaggedValue lexicalEnv,
1270 uint32_t levelIndex, uint32_t slotIndex, JSTaggedValue obj)
1271 {
1272 INTERPRETER_TRACE(thread, TestIn);
1273 [[maybe_unused]] EcmaHandleScope handleScope(thread);
1274 return RuntimeStubs::RuntimeTestIn(thread, lexicalEnv, levelIndex, slotIndex, obj);
1275 }
1276 } // namespace panda::ecmascript
1277