• Home
  • Raw
  • Download

Lines Matching full:thread

60 JSTaggedValue RuntimeStubs::RuntimeInc(JSThread *thread, const JSHandle<JSTaggedValue> &value)  in RuntimeInc()  argument
62 JSHandle<JSTaggedValue> inputVal = JSTaggedValue::ToNumeric(thread, value); in RuntimeInc()
63 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeInc()
66 return BigInt::BigintAddOne(thread, bigValue).GetTaggedValue(); in RuntimeInc()
72 JSTaggedValue RuntimeStubs::RuntimeDec(JSThread *thread, const JSHandle<JSTaggedValue> &value) in RuntimeDec() argument
74 JSHandle<JSTaggedValue> inputVal = JSTaggedValue::ToNumeric(thread, value); in RuntimeDec()
75 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeDec()
78 return BigInt::BigintSubOne(thread, bigValue).GetTaggedValue(); in RuntimeDec()
84 JSTaggedValue RuntimeStubs::RuntimeExp(JSThread *thread, JSTaggedValue base, JSTaggedValue exponent) in RuntimeExp() argument
86 JSHandle<JSTaggedValue> baseTag(thread, base); in RuntimeExp()
87 JSHandle<JSTaggedValue> exponentTag(thread, exponent); in RuntimeExp()
88 JSHandle<JSTaggedValue> valBase = JSTaggedValue::ToNumeric(thread, baseTag); in RuntimeExp()
89 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeExp()
90 JSHandle<JSTaggedValue> valExponent = JSTaggedValue::ToNumeric(thread, exponentTag); in RuntimeExp()
91 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeExp()
96 return BigInt::Exponentiate(thread, bigBaseVale, bigExponentValue).GetTaggedValue(); in RuntimeExp()
98 … THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot mix BigInt and other types, use explicit conversions", in RuntimeExp()
120 JSTaggedValue RuntimeStubs::RuntimeIsIn(JSThread *thread, const JSHandle<JSTaggedValue> &prop, in RuntimeIsIn() argument
124 return RuntimeThrowTypeError(thread, "Cannot use 'in' operator in Non-Object"); in RuntimeIsIn()
126 JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, prop); in RuntimeIsIn()
127 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeIsIn()
128 bool ret = JSTaggedValue::HasProperty(thread, obj, propKey); in RuntimeIsIn()
129 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeIsIn()
133 JSTaggedValue RuntimeStubs::RuntimeInstanceof(JSThread *thread, const JSHandle<JSTaggedValue> &obj, in RuntimeInstanceof() argument
136 bool ret = JSObject::InstanceOf(thread, obj, target); in RuntimeInstanceof()
137 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeInstanceof()
141 JSTaggedValue RuntimeStubs::RuntimeInstanceofByHandler(JSThread *thread, JSHandle<JSTaggedValue> ta… in RuntimeInstanceofByHandler() argument
146 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeInstanceofByHandler()
150 JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv(); in RuntimeInstanceofByHandler()
155 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeInstanceofByHandler()
156 … EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, instOfHandler, target, in RuntimeInstanceofByHandler()
158 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeInstanceofByHandler()
162 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeInstanceofByHandler()
168 …THROW_TYPE_ERROR_AND_RETURN(thread, "InstanceOf error when target is not Callable", JSTaggedValue:… in RuntimeInstanceofByHandler()
172 bool res = JSFunction::OrdinaryHasInstance(thread, target, object); in RuntimeInstanceofByHandler()
173 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeInstanceofByHandler()
177 JSTaggedValue RuntimeStubs::RuntimeCreateGeneratorObj(JSThread *thread, const JSHandle<JSTaggedValu… in RuntimeCreateGeneratorObj() argument
179 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeCreateGeneratorObj()
182 context->SetGeneratorObject(thread, obj.GetTaggedValue()); in RuntimeCreateGeneratorObj()
186 obj->SetGeneratorContext(thread, context); in RuntimeCreateGeneratorObj()
188 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCreateGeneratorObj()
192 JSTaggedValue RuntimeStubs::RuntimeCreateAsyncGeneratorObj(JSThread *thread, const JSHandle<JSTagge… in RuntimeCreateAsyncGeneratorObj() argument
194 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeCreateAsyncGeneratorObj()
197 context->SetGeneratorObject(thread, obj.GetTaggedValue()); in RuntimeCreateAsyncGeneratorObj()
201 obj->SetGeneratorContext(thread, context); in RuntimeCreateAsyncGeneratorObj()
203 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCreateAsyncGeneratorObj()
207 JSTaggedValue RuntimeStubs::RuntimeGetTemplateObject(JSThread *thread, const JSHandle<JSTaggedValue… in RuntimeGetTemplateObject() argument
209 JSHandle<JSTaggedValue> templateObj = TemplateString::GetTemplateObject(thread, literal); in RuntimeGetTemplateObject()
210 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGetTemplateObject()
214 JSTaggedValue RuntimeStubs::RuntimeGetNextPropName(JSThread *thread, const JSHandle<JSTaggedValue> … in RuntimeGetNextPropName() argument
217 … JSTaggedValue res = JSForInIterator::NextInternal(thread, JSHandle<JSForInIterator>::Cast(iter)); in RuntimeGetNextPropName()
218 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGetNextPropName()
222 JSTaggedValue RuntimeStubs::RuntimeIterNext(JSThread *thread, const JSHandle<JSTaggedValue> &iter) in RuntimeIterNext() argument
224 JSHandle<JSTaggedValue> resultObj = JSIterator::IteratorNext(thread, iter); in RuntimeIterNext()
225 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeIterNext()
229 JSTaggedValue RuntimeStubs::RuntimeCloseIterator(JSThread *thread, const JSHandle<JSTaggedValue> &i… in RuntimeCloseIterator() argument
231 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeCloseIterator()
232 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in RuntimeCloseIterator()
235 if (thread->HasPendingException()) { in RuntimeCloseIterator()
237 CompletionRecordType::THROW, JSHandle<JSTaggedValue>(thread, thread->GetException()))); in RuntimeCloseIterator()
242 JSHandle<JSTaggedValue> result = JSIterator::IteratorClose(thread, iter, record); in RuntimeCloseIterator()
243 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCloseIterator()
245 return CompletionRecord::Cast(result->GetTaggedObject())->GetValue(thread); in RuntimeCloseIterator()
250 JSTaggedValue RuntimeStubs::RuntimeSuperCallSpread(JSThread *thread, const JSHandle<JSTaggedValue> … in RuntimeSuperCallSpread() argument
254 JSHandle<JSTaggedValue> superFunc(thread, JSTaggedValue::GetPrototype(thread, func)); in RuntimeSuperCallSpread()
255 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSuperCallSpread()
257 …THROW_TYPE_ERROR_AND_RETURN(thread, "Super constructor is not JSFunction", JSTaggedValue::Exceptio… in RuntimeSuperCallSpread()
260 JSHandle<TaggedArray> argv(thread, RuntimeGetCallSpreadArgs(thread, array)); in RuntimeSuperCallSpread()
261 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSuperCallSpread()
263 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeSuperCallSpread()
265 EcmaInterpreter::NewRuntimeCallInfo(thread, superFunc, undefined, newTarget, argsLength); in RuntimeSuperCallSpread()
266 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSuperCallSpread()
269 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSuperCallSpread()
274 JSTaggedValue RuntimeStubs::RuntimeOptSuperCallSpread(JSThread *thread, const JSHandle<JSTaggedValu… in RuntimeOptSuperCallSpread() argument
278 JSHandle<JSTaggedValue> superFunc(thread, JSTaggedValue::GetPrototype(thread, func)); in RuntimeOptSuperCallSpread()
279 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptSuperCallSpread()
281 …THROW_TYPE_ERROR_AND_RETURN(thread, "Super constructor is not JSFunction", JSTaggedValue::Exceptio… in RuntimeOptSuperCallSpread()
284 JSHandle<TaggedArray> argv(thread, taggedArray.GetTaggedValue()); in RuntimeOptSuperCallSpread()
285 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptSuperCallSpread()
287 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeOptSuperCallSpread()
289 EcmaInterpreter::NewRuntimeCallInfo(thread, superFunc, undefined, newTarget, argsLength); in RuntimeOptSuperCallSpread()
290 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptSuperCallSpread()
293 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptSuperCallSpread()
298 JSTaggedValue RuntimeStubs::RuntimeSuperCallForwardAllArgs(JSThread *thread, JSTaggedType *sp, in RuntimeSuperCallForwardAllArgs() argument
304 …THROW_TYPE_ERROR_AND_RETURN(thread, "Super constructor is not a constructor", JSTaggedValue::Excep… in RuntimeSuperCallForwardAllArgs()
308 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeSuperCallForwardAllArgs()
310 EcmaInterpreter::NewRuntimeCallInfo(thread, superFunc, undefined, newTarget, restNumArgs); in RuntimeSuperCallForwardAllArgs()
311 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSuperCallForwardAllArgs()
319 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSuperCallForwardAllArgs()
323 JSTaggedValue RuntimeStubs::RuntimeDelObjProp(JSThread *thread, const JSHandle<JSTaggedValue> &obj, in RuntimeDelObjProp() argument
326 JSHandle<JSTaggedValue> jsObj(JSTaggedValue::ToObject(thread, obj)); in RuntimeDelObjProp()
327 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeDelObjProp()
328 JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, prop); in RuntimeDelObjProp()
329 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeDelObjProp()
330 bool ret = JSTaggedValue::DeletePropertyOrThrow(thread, jsObj, propKey); in RuntimeDelObjProp()
331 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeDelObjProp()
335 JSTaggedValue RuntimeStubs::RuntimeNewObjApply(JSThread *thread, const JSHandle<JSTaggedValue> &fun… in RuntimeNewObjApply() argument
338 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeNewObjApply()
340 return RuntimeThrowTypeError(thread, "Cannot Newobjspread"); in RuntimeNewObjApply()
346 auto prop = JSTaggedValue::GetProperty(thread, array, i).GetValue(); in RuntimeNewObjApply()
347 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeNewObjApply()
348 argsArray->Set(thread, i, prop); in RuntimeNewObjApply()
349 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeNewObjApply()
351 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeNewObjApply()
352 …EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, func, undefined, func, len… in RuntimeNewObjApply()
353 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeNewObjApply()
358 JSTaggedValue RuntimeStubs::RuntimeCreateIterResultObj(JSThread *thread, const JSHandle<JSTaggedVal… in RuntimeCreateIterResultObj() argument
363 JSHandle<JSObject> iter = JSIterator::CreateIterResultObject(thread, value, done); in RuntimeCreateIterResultObj()
364 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCreateIterResultObj()
368 JSTaggedValue RuntimeStubs::RuntimeAsyncFunctionAwaitUncaught(JSThread *thread, in RuntimeAsyncFunctionAwaitUncaught() argument
372 JSAsyncFunction::AsyncFunctionAwait(thread, asyncFuncObj, value); in RuntimeAsyncFunctionAwaitUncaught()
373 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAsyncFunctionAwaitUncaught()
375 JSHandle<JSObject> obj = JSTaggedValue::ToObject(thread, asyncFuncObj); in RuntimeAsyncFunctionAwaitUncaught()
376 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAsyncFunctionAwaitUncaught()
378 JSHandle<TaggedQueue> queue(thread, generator->GetAsyncGeneratorQueue(thread)); in RuntimeAsyncFunctionAwaitUncaught()
379 if (queue->Empty(thread)) { in RuntimeAsyncFunctionAwaitUncaught()
382 JSHandle<AsyncGeneratorRequest> next(thread, queue->Front(thread)); in RuntimeAsyncFunctionAwaitUncaught()
383 JSHandle<PromiseCapability> completion(thread, next->GetCapability(thread)); in RuntimeAsyncFunctionAwaitUncaught()
384 JSHandle<JSPromise> promise(thread, completion->GetPromise(thread)); in RuntimeAsyncFunctionAwaitUncaught()
388 JSHandle<JSPromise> promise(thread, asyncFuncObjHandle->GetPromise(thread)); in RuntimeAsyncFunctionAwaitUncaught()
390 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAsyncFunctionAwaitUncaught()
394 JSTaggedValue RuntimeStubs::RuntimeAsyncFunctionResolveOrReject(JSThread *thread, in RuntimeAsyncFunctionResolveOrReject() argument
398 JSHandle<JSPromise> promise(thread, asyncFuncObjHandle->GetPromise(thread)); in RuntimeAsyncFunctionResolveOrReject()
400 if (thread->GetEcmaVM()->GetJSOptions().EnablePendingCheak()) { in RuntimeAsyncFunctionResolveOrReject()
401 thread->GetEcmaVM()->RemoveAsyncStackTrace(promise); in RuntimeAsyncFunctionResolveOrReject()
404 …JSHandle<ResolvingFunctionsRecord> reactions = JSPromise::CreateResolvingFunctions(thread, promise… in RuntimeAsyncFunctionResolveOrReject()
405 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in RuntimeAsyncFunctionResolveOrReject()
409 activeFunc = JSHandle<JSTaggedValue>(thread, reactions->GetResolveFunction(thread)); in RuntimeAsyncFunctionResolveOrReject()
411 activeFunc = JSHandle<JSTaggedValue>(thread, reactions->GetRejectFunction(thread)); in RuntimeAsyncFunctionResolveOrReject()
413 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeAsyncFunctionResolveOrReject()
414 …EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, activeFunc, thisArg, undef… in RuntimeAsyncFunctionResolveOrReject()
415 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAsyncFunctionResolveOrReject()
419 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAsyncFunctionResolveOrReject()
423 JSTaggedValue RuntimeStubs::RuntimeAsyncGeneratorResolve(JSThread *thread, JSHandle<JSTaggedValue> … in RuntimeAsyncGeneratorResolve() argument
426 [[maybe_unused]] EcmaHandleScope handleScope(thread); in RuntimeAsyncGeneratorResolve()
430 …JSHandle<GeneratorContext> genContextHandle(thread, asyncGeneratorObjHandle->GetGeneratorContext(t… in RuntimeAsyncGeneratorResolve()
432 SaveFrameToContext(thread, genContextHandle); in RuntimeAsyncGeneratorResolve()
437 …return JSAsyncGeneratorObject::AsyncGeneratorResolve(thread, asyncGeneratorObjHandle, valueHandle,… in RuntimeAsyncGeneratorResolve()
440 JSTaggedValue RuntimeStubs::RuntimeAsyncGeneratorReject(JSThread *thread, JSHandle<JSTaggedValue> a… in RuntimeAsyncGeneratorReject() argument
443 [[maybe_unused]] EcmaHandleScope handleScope(thread); in RuntimeAsyncGeneratorReject()
448 … return JSAsyncGeneratorObject::AsyncGeneratorReject(thread, asyncGeneratorObjHandle, valueHandle); in RuntimeAsyncGeneratorReject()
451 JSTaggedValue RuntimeStubs::RuntimeCopyDataProperties(JSThread *thread, const JSHandle<JSTaggedValu… in RuntimeCopyDataProperties() argument
456 JSHandle<JSTaggedValue> from(JSTaggedValue::ToObject(thread, src)); in RuntimeCopyDataProperties()
457 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCopyDataProperties()
458 JSHandle<TaggedArray> keys = JSTaggedValue::GetOwnPropertyKeys(thread, from); in RuntimeCopyDataProperties()
459 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCopyDataProperties()
461 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined()); in RuntimeCopyDataProperties()
464 PropertyDescriptor desc(thread); in RuntimeCopyDataProperties()
465 key.Update(keys->Get(thread, i)); in RuntimeCopyDataProperties()
466 bool success = JSTaggedValue::GetOwnProperty(thread, from, key, desc); in RuntimeCopyDataProperties()
467 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCopyDataProperties()
472 JSTaggedValue::DefineOwnProperty(thread, dst, key, desc); in RuntimeCopyDataProperties()
473 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCopyDataProperties()
480 JSTaggedValue RuntimeStubs::RuntimeStArraySpread(JSThread *thread, const JSHandle<JSTaggedValue> &d… in RuntimeStArraySpread() argument
483 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeStArraySpread()
484 JSHandle<JSTaggedValue> undefinedHandle(thread, JSTaggedValue::Undefined()); in RuntimeStArraySpread()
488 THROW_TYPE_ERROR_AND_RETURN(thread, "src is not iterable", JSTaggedValue::Exception()); in RuntimeStArraySpread()
491 THROW_TYPE_ERROR_AND_RETURN(thread, "dst is not iterable", JSTaggedValue::Exception()); in RuntimeStArraySpread()
494 JSHandle<EcmaString> srcString = JSTaggedValue::ToString(thread, src); in RuntimeStArraySpread()
495 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStArraySpread()
496 JSHandle<EcmaString> srcFlat = JSHandle<EcmaString>(thread, in RuntimeStArraySpread()
497 EcmaStringAccessor::Flatten(thread->GetEcmaVM(), srcString)); in RuntimeStArraySpread()
501 uint16_t res = EcmaStringAccessor(srcFlat).Get<false>(thread, i); in RuntimeStArraySpread()
503 JSTaggedValue::SetProperty(thread, dst, dstLen + i, strValue, true); in RuntimeStArraySpread()
504 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStArraySpread()
506 JSHandle<JSTaggedValue> length(thread, JSTaggedValue(dstLen + strLen)); in RuntimeStArraySpread()
508 JSHandle<JSTaggedValue> lengthKey = thread->GlobalConstants()->GetHandledLengthString(); in RuntimeStArraySpread()
509 JSTaggedValue::SetProperty(thread, dst, lengthKey, length); in RuntimeStArraySpread()
514 if (index.GetInt() == 0 && src->IsStableJSArray(thread)) { in RuntimeStArraySpread()
515 … JSHandle<TaggedArray> srcElements(thread, JSHandle<JSObject>::Cast(src)->GetElements(thread)); in RuntimeStArraySpread()
519 dstArray->SetElements(thread, dstElements); in RuntimeStArraySpread()
520 dstArray->SetArrayLength(thread, length); in RuntimeStArraySpread()
523 ElementAccessor::CopyJSArrayObject(thread, srcObj, dstObj, length); in RuntimeStArraySpread()
525 JSHandle<JSTaggedValue> reg(thread, ElementAccessor::Get(thread, srcObj, i)); in RuntimeStArraySpread()
527 …JSHandle<JSTaggedValue> reg2(thread, JSArray::FastGetPropertyByValue(thread, src, i).GetTaggedValu… in RuntimeStArraySpread()
528 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStArraySpread()
530 ElementAccessor::Set(thread, dstObj, i, undefinedHandle, true); in RuntimeStArraySpread()
532 ElementAccessor::Set(thread, dstObj, i, reg2, true); in RuntimeStArraySpread()
535 ElementAccessor::Set(thread, dstObj, i, reg, true); in RuntimeStArraySpread()
542 auto globalConst = thread->GlobalConstants(); in RuntimeStArraySpread()
548 JSHandle<JSTaggedValue> valuesMethod = JSObject::GetMethod(thread, src, valuesStr); in RuntimeStArraySpread()
549 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStArraySpread()
550 iter = JSIterator::GetIterator(thread, src, valuesMethod); in RuntimeStArraySpread()
551 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStArraySpread()
553 iter = JSIterator::GetIterator(thread, src); in RuntimeStArraySpread()
554 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStArraySpread()
557 JSMutableHandle<JSTaggedValue> indexHandle(thread, index); in RuntimeStArraySpread()
559 PropertyDescriptor desc(thread); in RuntimeStArraySpread()
563 iterResult = JSIterator::IteratorStep(thread, iter); in RuntimeStArraySpread()
564 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStArraySpread()
568 bool success = JSTaggedValue::GetOwnProperty(thread, iterResult, valueStr, desc); in RuntimeStArraySpread()
569 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStArraySpread()
571 JSTaggedValue::DefineOwnProperty(thread, dst, indexHandle, desc); in RuntimeStArraySpread()
572 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStArraySpread()
579 JSHandle<JSTaggedValue> lengthKey = thread->GlobalConstants()->GetHandledLengthString(); in RuntimeStArraySpread()
580 JSTaggedValue::SetProperty(thread, dst, lengthKey, indexHandle); in RuntimeStArraySpread()
585 JSTaggedValue RuntimeStubs::RuntimeGetIteratorNext(JSThread *thread, const JSHandle<JSTaggedValue> … in RuntimeGetIteratorNext() argument
589 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeGetIteratorNext()
590 …EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, method, obj, undefined, 0); in RuntimeGetIteratorNext()
592 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGetIteratorNext()
594 return RuntimeThrowTypeError(thread, "the Iterator is not an ecmaobject."); in RuntimeGetIteratorNext()
599 JSTaggedValue RuntimeStubs::RuntimeSetObjectWithProto(JSThread *thread, const JSHandle<JSTaggedValu… in RuntimeSetObjectWithProto() argument
606 …THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING(SetProtoWithSendable), JSTaggedValue::Excep… in RuntimeSetObjectWithProto()
608 JSObject::SetPrototype(thread, obj, proto, true); in RuntimeSetObjectWithProto()
609 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSetObjectWithProto()
613 JSTaggedValue RuntimeStubs::RuntimeLdObjByValue(JSThread *thread, const JSHandle<JSTaggedValue> &ob… in RuntimeLdObjByValue() argument
621 … JSTaggedValue::RequireObjectCoercible(thread, obj, "Cannot load property of null or undefined"); in RuntimeLdObjByValue()
622 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdObjByValue()
626 res = JSObject::CallGetter(thread, AccessorData::Cast(receiver.GetTaggedObject()), object); in RuntimeLdObjByValue()
627 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdObjByValue()
629 JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, prop); in RuntimeLdObjByValue()
630 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdObjByValue()
631 res = JSTaggedValue::GetProperty(thread, object, propKey).GetValue().GetTaggedValue(); in RuntimeLdObjByValue()
633 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdObjByValue()
637 JSTaggedValue RuntimeStubs::RuntimeStObjByValue(JSThread *thread, const JSHandle<JSTaggedValue> &ob… in RuntimeStObjByValue() argument
645 … JSTaggedValue::RequireObjectCoercible(thread, obj, "Cannot store property of null or undefined"); in RuntimeStObjByValue()
646 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStObjByValue()
648 JSHandle<JSTaggedValue> propKey(JSTaggedValue::ToPropertyKey(thread, prop)); in RuntimeStObjByValue()
649 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStObjByValue()
651 JSTaggedValue::SetProperty(thread, object, propKey, value, true); in RuntimeStObjByValue()
652 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStObjByValue()
656 JSTaggedValue RuntimeStubs::RuntimeStOwnByValue(JSThread *thread, const JSHandle<JSTaggedValue> &ob… in RuntimeStOwnByValue() argument
660 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in RuntimeStOwnByValue()
662 …if (obj->IsClassConstructor() && JSTaggedValue::SameValue(thread, key, globalConst->GetHandledProt… in RuntimeStOwnByValue()
663 …return RuntimeThrowTypeError(thread, "In a class, static property named 'prototype' throw a TypeEr… in RuntimeStOwnByValue()
669 PropertyDescriptor desc(thread, value, true, enumerable, true); in RuntimeStOwnByValue()
670 JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, key); in RuntimeStOwnByValue()
671 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStOwnByValue()
672 bool ret = JSTaggedValue::DefineOwnProperty(thread, obj, propKey, desc); in RuntimeStOwnByValue()
673 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStOwnByValue()
675 return RuntimeThrowTypeError(thread, "StOwnByValue failed"); in RuntimeStOwnByValue()
680 JSTaggedValue RuntimeStubs::RuntimeLdSuperByValue(JSThread *thread, const JSHandle<JSTaggedValue> &… in RuntimeLdSuperByValue() argument
685 …JSHandle<JSTaggedValue> homeObject(thread, JSFunction::Cast(thisFunc.GetTaggedObject())->GetHomeOb… in RuntimeLdSuperByValue()
686 JSHandle<JSTaggedValue> superBase(thread, JSTaggedValue::GetSuperBase(thread, homeObject)); in RuntimeLdSuperByValue()
687 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdSuperByValue()
688 JSTaggedValue::RequireObjectCoercible(thread, superBase); in RuntimeLdSuperByValue()
689 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdSuperByValue()
690 JSHandle<JSTaggedValue> propKey(JSTaggedValue::ToPropertyKey(thread, key)); in RuntimeLdSuperByValue()
691 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdSuperByValue()
693 …JSTaggedValue res = JSTaggedValue::GetProperty(thread, superBase, propKey, obj).GetValue().GetTagg… in RuntimeLdSuperByValue()
694 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdSuperByValue()
698 JSTaggedValue RuntimeStubs::RuntimeStSuperByValue(JSThread *thread, const JSHandle<JSTaggedValue> &… in RuntimeStSuperByValue() argument
704 …JSHandle<JSTaggedValue> homeObject(thread, JSFunction::Cast(thisFunc.GetTaggedObject())->GetHomeOb… in RuntimeStSuperByValue()
705 JSHandle<JSTaggedValue> superBase(thread, JSTaggedValue::GetSuperBase(thread, homeObject)); in RuntimeStSuperByValue()
706 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStSuperByValue()
707 JSTaggedValue::RequireObjectCoercible(thread, superBase); in RuntimeStSuperByValue()
708 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStSuperByValue()
709 JSHandle<JSTaggedValue> propKey(JSTaggedValue::ToPropertyKey(thread, key)); in RuntimeStSuperByValue()
710 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStSuperByValue()
713 JSTaggedValue::SetProperty(thread, superBase, propKey, value, obj, true); in RuntimeStSuperByValue()
714 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStSuperByValue()
718 JSTaggedValue RuntimeStubs::RuntimeLdObjByIndex(JSThread *thread, const JSHandle<JSTaggedValue> &ob… in RuntimeLdObjByIndex() argument
723 res = JSObject::CallGetter(thread, AccessorData::Cast(receiver.GetTaggedObject()), obj); in RuntimeLdObjByIndex()
725 res = JSTaggedValue::GetProperty(thread, obj, idx).GetValue().GetTaggedValue(); in RuntimeLdObjByIndex()
727 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdObjByIndex()
731 JSTaggedValue RuntimeStubs::RuntimeLdObjByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue p… in RuntimeLdObjByName() argument
734 JSHandle<JSTaggedValue> objHandle(thread, obj); in RuntimeLdObjByName()
737 … res = JSObject::CallGetter(thread, AccessorData::Cast(receiver.GetTaggedObject()), objHandle); in RuntimeLdObjByName()
739 JSHandle<JSTaggedValue> propHandle(thread, prop); in RuntimeLdObjByName()
740 res = JSTaggedValue::GetProperty(thread, objHandle, propHandle).GetValue().GetTaggedValue(); in RuntimeLdObjByName()
742 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdObjByName()
746 JSTaggedValue RuntimeStubs::RuntimeStObjByName(JSThread *thread, const JSHandle<JSTaggedValue> &obj, in RuntimeStObjByName() argument
750 JSTaggedValue::SetProperty(thread, obj, prop, value, true); in RuntimeStObjByName()
751 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStObjByName()
755 JSTaggedValue RuntimeStubs::RuntimeStObjByIndex(JSThread *thread, const JSHandle<JSTaggedValue> &ob… in RuntimeStObjByIndex() argument
758 JSTaggedValue::SetProperty(thread, obj, idx, value, true); in RuntimeStObjByIndex()
759 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStObjByIndex()
763 JSTaggedValue RuntimeStubs::RuntimeStOwnByIndex(JSThread *thread, const JSHandle<JSTaggedValue> &ob… in RuntimeStOwnByIndex() argument
770 PropertyDescriptor desc(thread, value, true, enumerable, true); in RuntimeStOwnByIndex()
771 bool ret = JSTaggedValue::DefineOwnProperty(thread, obj, idx, desc); in RuntimeStOwnByIndex()
772 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStOwnByIndex()
774 return RuntimeThrowTypeError(thread, "SetOwnByIndex failed"); in RuntimeStOwnByIndex()
779 JSTaggedValue RuntimeStubs::RuntimeStGlobalRecord(JSThread *thread, const JSHandle<JSTaggedValue> &… in RuntimeStGlobalRecord() argument
782 ObjectFactory* factory = thread->GetEcmaVM()->GetFactory(); in RuntimeStGlobalRecord()
783 if (thread->GetEcmaVM()->GetJSOptions().IsEnableLoweringBuiltin()) { in RuntimeStGlobalRecord()
785 auto index = builtinIndex.GetBuiltinIndex(thread, prop.GetTaggedValue()); in RuntimeStGlobalRecord()
787 … auto box = factory->NewPropertyBox(JSHandle<JSTaggedValue>(thread, JSTaggedValue::Hole())); in RuntimeStGlobalRecord()
788 thread->GetBuiltinEntriesPointer()->ClearByIndex(index, box.GetTaggedValue()); in RuntimeStGlobalRecord()
792 EcmaVM *vm = thread->GetEcmaVM(); in RuntimeStGlobalRecord()
797 int entry = dict->FindEntry(thread, prop.GetTaggedValue()); in RuntimeStGlobalRecord()
800 … message.append(EcmaStringAccessor(JSTaggedValue::ToString(thread, prop)).ToStdString(thread)); in RuntimeStGlobalRecord()
803 return RuntimeThrowSyntaxError(thread, "Duplicate identifier"); in RuntimeStGlobalRecord()
810 JSHandle<GlobalDictionary> dictHandle(thread, dict); in RuntimeStGlobalRecord()
815 …dict = *GlobalDictionary::PutIfAbsent(thread, dictHandle, prop, JSHandle<JSTaggedValue>(box), attr… in RuntimeStGlobalRecord()
816 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStGlobalRecord()
817 env->SetGlobalRecord(thread, JSTaggedValue(dict)); in RuntimeStGlobalRecord()
821 JSTaggedValue RuntimeStubs::RuntimeNeg(JSThread *thread, const JSHandle<JSTaggedValue> &value) in RuntimeNeg() argument
823 JSHandle<JSTaggedValue> inputVal = JSTaggedValue::ToNumeric(thread, value); in RuntimeNeg()
824 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeNeg()
827 return BigInt::UnaryMinus(thread, bigValue).GetTaggedValue(); in RuntimeNeg()
847 JSTaggedValue RuntimeStubs::RuntimeNot(JSThread *thread, const JSHandle<JSTaggedValue> &value) in RuntimeNot() argument
849 JSHandle<JSTaggedValue> inputVal = JSTaggedValue::ToNumeric(thread, value); in RuntimeNot()
850 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeNot()
853 return BigInt::BitwiseNOT(thread, bigValue).GetTaggedValue(); in RuntimeNot()
855 int32_t number = JSTaggedValue::ToInt32(thread, inputVal); in RuntimeNot()
859 JSTaggedValue RuntimeStubs::RuntimeResolveClass(JSThread *thread, const JSHandle<JSFunction> &ctor, in RuntimeResolveClass() argument
866 FrameHandler frameHandler(thread); in RuntimeResolveClass()
868 …JSHandle<JSTaggedValue> ecmaModule(thread, JSFunction::Cast(currentFunc.GetTaggedObject())->GetMod… in RuntimeResolveClass()
870 RuntimeSetClassInheritanceRelationship(thread, JSHandle<JSTaggedValue>(ctor), base); in RuntimeResolveClass()
871 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeResolveClass()
878 JSTaggedValue value = literal->Get(thread, index); in RuntimeResolveClass()
881 func->SetLexicalEnv(thread, lexenv.GetTaggedValue()); in RuntimeResolveClass()
882 func->SetModule(thread, ecmaModule); in RuntimeResolveClass()
889 JSTaggedValue RuntimeStubs::RuntimeCloneClassFromTemplate(JSThread *thread, const JSHandle<JSFuncti… in RuntimeCloneClassFromTemplate() argument
893 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeCloneClassFromTemplate()
894 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in RuntimeCloneClassFromTemplate()
897 JSHandle<JSObject> clsPrototype(thread, ctor->GetFunctionPrototype(thread)); in RuntimeCloneClassFromTemplate()
901 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCloneClassFromTemplate()
904 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCloneClassFromTemplate()
907 …JSFunction::SetFunctionPrototypeOrInstanceHClass(thread, cloneClass, cloneClassPrototype.GetTagged… in RuntimeCloneClassFromTemplate()
908 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCloneClassFromTemplate()
910 PropertyDescriptor ctorDesc(thread, JSHandle<JSTaggedValue>(cloneClass), true, false, true); in RuntimeCloneClassFromTemplate()
911 JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle<JSTaggedValue>(cloneClassPrototype), in RuntimeCloneClassFromTemplate()
913 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCloneClassFromTemplate()
915 cloneClass->SetHomeObject(thread, cloneClassPrototype); in RuntimeCloneClassFromTemplate()
918 RuntimeSetClassInheritanceRelationship(thread, JSHandle<JSTaggedValue>(cloneClass), base); in RuntimeCloneClassFromTemplate()
919 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCloneClassFromTemplate()
934 bool RuntimeStubs::MaybeHasInterfacesType(JSThread *thread, const JSHandle<TaggedArray> &arrayHandl… in MaybeHasInterfacesType() argument
937 …return arrayHandle->GetLength() != 0 && arrayHandle->Get(thread, arrayHandle->GetLength() - 1).IsS… in MaybeHasInterfacesType()
940 void RuntimeStubs::DefineInterfaceTypeOwnProperty(JSThread *thread, JSHandle<JSFunction> &cls, in DefineInterfaceTypeOwnProperty() argument
951 thread, extractor, arrayHandle, arrayHandle->GetLength(), ClassKind::NON_SENDABLE, 1); in DefineInterfaceTypeOwnProperty()
952 cls = EntranceForDefineClass(thread, base, lexenv, extractor, ihc, chc, classLiteral); in DefineInterfaceTypeOwnProperty()
953 JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv(); in DefineInterfaceTypeOwnProperty()
955 …JSHandle<JSTaggedValue> interfaceTypeValue(thread, arrayHandle->Get(thread, arrayHandle->GetLength… in DefineInterfaceTypeOwnProperty()
956 PropertyDescriptor desc(thread, interfaceTypeValue, false, false, false); in DefineInterfaceTypeOwnProperty()
958 thread, JSHandle<JSObject>::Cast(cls), interfaceTypeSymbol, desc); in DefineInterfaceTypeOwnProperty()
961 JSHandle<JSFunction> RuntimeStubs::EntranceForDefineClass(JSThread *thread, in EntranceForDefineClass() argument
971 return ClassHelper::DefineClassWithIHClass(thread, base, extractor, lexenv, ihc, chc); in EntranceForDefineClass()
973 return ClassHelper::DefineClassFromExtractor(thread, base, extractor, lexenv); in EntranceForDefineClass()
977 JSTaggedValue RuntimeStubs::RuntimeCreateClassWithBuffer(JSThread *thread, in RuntimeCreateClassWithBuffer() argument
986 …THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING(NotSendableSubClass), JSTaggedValue::Except… in RuntimeCreateClassWithBuffer()
988 [[maybe_unused]] EcmaHandleScope handleScope(thread); in RuntimeCreateClassWithBuffer()
989 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeCreateClassWithBuffer()
990 CString entry = ModuleManager::GetRecordName(thread, module.GetTaggedValue()); in RuntimeCreateClassWithBuffer()
993 auto methodObj = ConstantPool::GetMethodFromCache(thread, constpool.GetTaggedValue(), methodId); in RuntimeCreateClassWithBuffer()
994 JSHandle<JSTaggedValue> method(thread, methodObj); in RuntimeCreateClassWithBuffer()
997 JSMutableHandle<JSTaggedValue> ihc(thread, JSTaggedValue::Undefined()); in RuntimeCreateClassWithBuffer()
998 JSMutableHandle<JSTaggedValue> chc(thread, JSTaggedValue::Undefined()); in RuntimeCreateClassWithBuffer()
1000 JSHandle<ConstantPool> cp(thread, in RuntimeCreateClassWithBuffer()
1001 thread->GetEcmaVM()->FindOrCreateUnsharedConstpool(constpoolHandle.GetTaggedValue())); in RuntimeCreateClassWithBuffer()
1002 JSTaggedValue val = cp->GetObjectFromCache(thread, literalId); in RuntimeCreateClassWithBuffer()
1004 JSHandle<AOTLiteralInfo> aotLiteralInfo(thread, val); in RuntimeCreateClassWithBuffer()
1005 ihc.Update(aotLiteralInfo->GetIhc(thread)); in RuntimeCreateClassWithBuffer()
1006 chc.Update(aotLiteralInfo->GetChc(thread)); in RuntimeCreateClassWithBuffer()
1009 JSTaggedValue literalObj = ConstantPool::GetClassLiteralFromCache(thread, cp, literalId, entry); in RuntimeCreateClassWithBuffer()
1011 JSHandle<ClassLiteral> classLiteral(thread, literalObj); in RuntimeCreateClassWithBuffer()
1012 JSHandle<TaggedArray> arrayHandle(thread, classLiteral->GetArray(thread)); in RuntimeCreateClassWithBuffer()
1016 if (instance->IsHybridVm() && MaybeHasInterfacesType(thread, arrayHandle)) { in RuntimeCreateClassWithBuffer()
1017 …DefineInterfaceTypeOwnProperty(thread, cls, base, lexenv, extractor, ihc, chc, arrayHandle, classL… in RuntimeCreateClassWithBuffer()
1020 …ClassInfoExtractor::BuildClassInfoExtractorFromLiteral(thread, extractor, arrayHandle, literalLeng… in RuntimeCreateClassWithBuffer()
1024 cls = ClassHelper::DefineClassWithIHClass(thread, base, extractor, lexenv, ihc, chc); in RuntimeCreateClassWithBuffer()
1026 cls = ClassHelper::DefineClassFromExtractor(thread, base, extractor, lexenv); in RuntimeCreateClassWithBuffer()
1030 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCreateClassWithBuffer()
1031 RuntimeSetClassInheritanceRelationship(thread, JSHandle<JSTaggedValue>(cls), base); in RuntimeCreateClassWithBuffer()
1032 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCreateClassWithBuffer()
1034 cls->SetLexicalEnv(thread, lexenv.GetTaggedValue()); in RuntimeCreateClassWithBuffer()
1035 cls->SetModule(thread, module.GetTaggedValue()); in RuntimeCreateClassWithBuffer()
1036 RuntimeSetClassConstructorLength(thread, cls.GetTaggedValue(), length.GetTaggedValue()); in RuntimeCreateClassWithBuffer()
1037 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCreateClassWithBuffer()
1042 void RuntimeStubs::SetProfileTypeInfoCellToFunction(JSThread *thread, const JSHandle<JSFunction> &j… in SetProfileTypeInfoCellToFunction() argument
1054 auto profileTypeInfo = jsFunc->GetProfileTypeInfo(thread); in SetProfileTypeInfoCellToFunction()
1056 JSHandle<Method> method(thread, jsFunc->GetMethod(thread)); in SetProfileTypeInfoCellToFunction()
1058 profileTypeInfo = RuntimeNotifyInlineCache(thread, jsFunc, slotSize); in SetProfileTypeInfoCellToFunction()
1063 JSHandle<ProfileTypeInfo> profileTypeArray(thread, profileTypeInfo); in SetProfileTypeInfoCellToFunction()
1064 JSTaggedValue slotValue = profileTypeArray->Get(thread, slotId); in SetProfileTypeInfoCellToFunction()
1066 JSHandle<JSTaggedValue> handleUndefined(thread, JSTaggedValue::Undefined()); in SetProfileTypeInfoCellToFunction()
1068 thread->GetEcmaVM()->GetFactory()->NewProfileTypeInfoCell(handleUndefined); in SetProfileTypeInfoCellToFunction()
1069 profileTypeArray->Set(thread, slotId, newProfileTypeInfoCell); in SetProfileTypeInfoCellToFunction()
1070 definedFunc->SetRawProfileTypeInfo(thread, newProfileTypeInfoCell); in SetProfileTypeInfoCellToFunction()
1073 cellPtr->UpdateProfileTypeInfoCellType(thread); in SetProfileTypeInfoCellToFunction()
1074 definedFunc->SetRawProfileTypeInfo(thread, slotValue); in SetProfileTypeInfoCellToFunction()
1078 JSTaggedValue RuntimeStubs::RuntimeCreateSharedClass(JSThread *thread, in RuntimeCreateSharedClass() argument
1085 …THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING(ClassNotDerivedFromShared), JSTaggedValue::… in RuntimeCreateSharedClass()
1087 [[maybe_unused]] EcmaHandleScope handleScope(thread); in RuntimeCreateSharedClass()
1088 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeCreateSharedClass()
1089 CString entry = ModuleManager::GetRecordName(thread, module.GetTaggedValue()); in RuntimeCreateSharedClass()
1091 auto methodObj = ConstantPool::GetMethodFromCache(thread, constpool.GetTaggedValue(), methodId); in RuntimeCreateSharedClass()
1092 JSHandle<JSTaggedValue> method(thread, methodObj); in RuntimeCreateSharedClass()
1096 JSHandle<JSTaggedValue> sendableEnv(thread, JSTaggedValue::Undefined()); in RuntimeCreateSharedClass()
1099 sendableEnv = JSHandle<JSTaggedValue>(thread, moduleRecord->GetSendableEnv(thread)); in RuntimeCreateSharedClass()
1102 thread, constpoolHandle, literalId, entry, sendableEnv, ClassKind::SENDABLE); in RuntimeCreateSharedClass()
1103 JSHandle<ClassLiteral> classLiteral(thread, literalObj); in RuntimeCreateSharedClass()
1104 JSHandle<TaggedArray> arrayHandle(thread, classLiteral->GetArray(thread)); in RuntimeCreateSharedClass()
1108 auto fieldTypeId = static_cast<uint32_t>(arrayHandle->Get(thread, literalLength - 1).GetInt()); in RuntimeCreateSharedClass()
1111 ClassInfoExtractor::BuildClassInfoExtractorFromLiteral(thread, extractor, arrayHandle, in RuntimeCreateSharedClass()
1114 …JSHandle<TaggedArray> fieldTypeArray = ConstantPool::GetFieldLiteral(thread, constpoolHandle, fiel… in RuntimeCreateSharedClass()
1115 …rray> staticFieldArray = SendableClassDefiner::ExtractStaticFieldTypeArray(thread, fieldTypeArray); in RuntimeCreateSharedClass()
1117 SendableClassDefiner::DefineSendableClassFromExtractor(thread, extractor, staticFieldArray); in RuntimeCreateSharedClass()
1118 ModuleManager *moduleManager = thread->GetModuleManager(); in RuntimeCreateSharedClass()
1122 sendableClsModuleRecord->SetSendableEnv(thread, sendableEnv); in RuntimeCreateSharedClass()
1124 cls->SetModule(thread, sendableClsModule.GetTaggedValue()); in RuntimeCreateSharedClass()
1125 RuntimeSetClassConstructorLength(thread, cls.GetTaggedValue(), JSTaggedValue(length)); in RuntimeCreateSharedClass()
1126 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCreateSharedClass()
1127 …RuntimeSetClassInheritanceRelationship(thread, JSHandle<JSTaggedValue>(cls), base, ClassKind::SEND… in RuntimeCreateSharedClass()
1128 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCreateSharedClass()
1132 …auto instanceFieldNums = static_cast<uint32_t>(fieldTypeArray->Get(thread, arrayLength - 1).GetInt… in RuntimeCreateSharedClass()
1136 …SendableClassDefiner::DefineSendableInstanceHClass(thread, fieldTypeArray, instanceLength, cls, ba… in RuntimeCreateSharedClass()
1140 JSTaggedValue RuntimeStubs::RuntimeSetClassInheritanceRelationship(JSThread *thread, in RuntimeSetClassInheritanceRelationship() argument
1145 JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv(); in RuntimeSetClassInheritanceRelationship()
1146 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in RuntimeSetClassInheritanceRelationship()
1166 …Method *method = Method::Cast(JSHandle<JSFunction>::Cast(ctor)->GetMethod(thread).GetTaggedObject(… in RuntimeSetClassInheritanceRelationship()
1174 parentPrototype = JSHandle<JSTaggedValue>(thread, JSTaggedValue::Null()); in RuntimeSetClassInheritanceRelationship()
1177 return RuntimeThrowTypeError(thread, "parent class is not constructor"); in RuntimeSetClassInheritanceRelationship()
1180 parentPrototype = JSTaggedValue::GetProperty(thread, parent, in RuntimeSetClassInheritanceRelationship()
1182 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSetClassInheritanceRelationship()
1184 return RuntimeThrowTypeError(thread, "parent class have no valid prototype"); in RuntimeSetClassInheritanceRelationship()
1188 ctor->GetTaggedObject()->GetClass()->SetPrototype(thread, parent); // __proto__ in RuntimeSetClassInheritanceRelationship()
1190 … JSHandle<JSObject> clsPrototype(thread, JSHandle<JSFunction>(ctor)->GetFunctionPrototype(thread)); in RuntimeSetClassInheritanceRelationship()
1191 clsPrototype->GetClass()->SetPrototype(thread, parentPrototype); in RuntimeSetClassInheritanceRelationship()
1196 … JSHClass::EnableProtoChangeMarker(thread, JSHandle<JSHClass>(thread, constructor->GetClass())); in RuntimeSetClassInheritanceRelationship()
1199 thread, in RuntimeSetClassInheritanceRelationship()
1200 …JSHandle<JSHClass>(thread, constructor->GetFunctionPrototype(thread).GetTaggedObject()->GetClass()… in RuntimeSetClassInheritanceRelationship()
1206 JSTaggedValue protoOrHClass = JSHandle<JSFunction>(ctor)->GetProtoOrHClass(thread); in RuntimeSetClassInheritanceRelationship()
1210 JSHandle<JSHClass> ihcHandle(thread, ihc); in RuntimeSetClassInheritanceRelationship()
1211 JSHClass::EnableProtoChangeMarker(thread, ihcHandle); in RuntimeSetClassInheritanceRelationship()
1214 JSHandle<JSObject> protoHandle(thread, protoOrHClass); in RuntimeSetClassInheritanceRelationship()
1216 …JSHClass::EnablePHCProtoChangeMarker(thread, JSHandle<JSHClass>(thread, protoHandle->GetJSHClass()… in RuntimeSetClassInheritanceRelationship()
1223 JSTaggedValue RuntimeStubs::RuntimeSetClassConstructorLength(JSThread *thread, JSTaggedValue ctor, in RuntimeSetClassConstructorLength() argument
1230 cls->SetPropertyInlinedProps(thread, JSFunction::LENGTH_INLINE_PROPERTY_INDEX, length); in RuntimeSetClassConstructorLength()
1232 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in RuntimeSetClassConstructorLength()
1233 cls->UpdatePropertyInDictionary(thread, globalConst->GetLengthString(), length); in RuntimeSetClassConstructorLength()
1238 JSTaggedValue RuntimeStubs::RuntimeNotifyInlineCache(JSThread *thread, const JSHandle<JSFunction> &… in RuntimeNotifyInlineCache() argument
1243 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeNotifyInlineCache()
1250 Method *method = Method::Cast(function->GetMethod(thread)); in RuntimeNotifyInlineCache()
1251 auto codeSize = method->GetCodeSize(thread); in RuntimeNotifyInlineCache()
1257 … JSFunction::SetProfileTypeInfo(thread, function, JSHandle<JSTaggedValue>::Cast(profileTypeInfo)); in RuntimeNotifyInlineCache()
1261 JSTaggedValue RuntimeStubs::RuntimeStOwnByValueWithNameSet(JSThread *thread, const JSHandle<JSTagge… in RuntimeStOwnByValueWithNameSet() argument
1265 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in RuntimeStOwnByValueWithNameSet()
1267 …if (obj->IsClassConstructor() && JSTaggedValue::SameValue(thread, key, globalConst->GetHandledProt… in RuntimeStOwnByValueWithNameSet()
1268 …return RuntimeThrowTypeError(thread, "In a class, static property named 'prototype' throw a TypeEr… in RuntimeStOwnByValueWithNameSet()
1274 PropertyDescriptor desc(thread, value, true, enumerable, true); in RuntimeStOwnByValueWithNameSet()
1275 JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, key); in RuntimeStOwnByValueWithNameSet()
1276 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStOwnByValueWithNameSet()
1277 bool ret = JSTaggedValue::DefineOwnProperty(thread, obj, propKey, desc); in RuntimeStOwnByValueWithNameSet()
1278 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStOwnByValueWithNameSet()
1280 return RuntimeThrowTypeError(thread, "StOwnByValueWithNameSet failed"); in RuntimeStOwnByValueWithNameSet()
1284 …propKey = JSHandle<JSTaggedValue>(base::NumberHelper::NumberToString(thread, propKey.GetTaggedValu… in RuntimeStOwnByValueWithNameSet()
1286 JSFunctionBase::SetFunctionName(thread, JSHandle<JSFunctionBase>::Cast(value), propKey, in RuntimeStOwnByValueWithNameSet()
1287 … JSHandle<JSTaggedValue>(thread, JSTaggedValue::Undefined())); in RuntimeStOwnByValueWithNameSet()
1292 JSTaggedValue RuntimeStubs::RuntimeStOwnByName(JSThread *thread, const JSHandle<JSTaggedValue> &obj, in RuntimeStOwnByName() argument
1301 PropertyDescriptor desc(thread, value, true, enumerable, true); in RuntimeStOwnByName()
1302 bool ret = JSTaggedValue::DefineOwnProperty(thread, obj, prop, desc); in RuntimeStOwnByName()
1303 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStOwnByName()
1305 return RuntimeThrowTypeError(thread, "SetOwnByName failed"); in RuntimeStOwnByName()
1310 JSTaggedValue RuntimeStubs::RuntimeStOwnByNameWithNameSet(JSThread *thread, in RuntimeStOwnByNameWithNameSet() argument
1316 JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, propHandle); in RuntimeStOwnByNameWithNameSet()
1317 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStOwnByNameWithNameSet()
1321 PropertyDescriptor desc(thread, valueHandle, true, enumerable, true); in RuntimeStOwnByNameWithNameSet()
1322 bool ret = JSTaggedValue::DefineOwnProperty(thread, objHandle, propHandle, desc); in RuntimeStOwnByNameWithNameSet()
1323 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStOwnByNameWithNameSet()
1325 return RuntimeThrowTypeError(thread, "SetOwnByNameWithNameSet failed"); in RuntimeStOwnByNameWithNameSet()
1327 JSFunctionBase::SetFunctionName(thread, JSHandle<JSFunctionBase>::Cast(valueHandle), propKey, in RuntimeStOwnByNameWithNameSet()
1328 JSHandle<JSTaggedValue>(thread, JSTaggedValue::Undefined())); in RuntimeStOwnByNameWithNameSet()
1332 JSTaggedValue RuntimeStubs::RuntimeSuspendGenerator(JSThread *thread, const JSHandle<JSTaggedValue>… in RuntimeSuspendGenerator() argument
1337 …JSHandle<GeneratorContext> genContextHandle(thread, generatorObjectHandle->GetGeneratorContext(thr… in RuntimeSuspendGenerator()
1339 SaveFrameToContext(thread, genContextHandle); in RuntimeSuspendGenerator()
1345 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSuspendGenerator()
1351 …JSHandle<GeneratorContext> genContextHandle(thread, generatorObjectHandle->GetGeneratorContext(thr… in RuntimeSuspendGenerator()
1353 generatorObjectHandle->SetTaskInfo(thread->GetTaskInfo()); in RuntimeSuspendGenerator()
1355 SaveFrameToContext(thread, genContextHandle); in RuntimeSuspendGenerator()
1360 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSuspendGenerator()
1363 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSuspendGenerator()
1367 return RuntimeThrowTypeError(thread, "RuntimeSuspendGenerator failed"); in RuntimeSuspendGenerator()
1370 void RuntimeStubs::RuntimeSetGeneratorState(JSThread *thread, const JSHandle<JSTaggedValue> &genObj, in RuntimeSetGeneratorState() argument
1374 …JSHandle<GeneratorContext> genContextHandle(thread, generatorObjectHandle->GetGeneratorContext(thr… in RuntimeSetGeneratorState()
1399 JSTaggedValue RuntimeStubs::RuntimeGetModuleNamespace(JSThread *thread, int32_t index) in RuntimeGetModuleNamespace() argument
1401 return ModuleValueAccessor::GetModuleNamespace(thread, index); in RuntimeGetModuleNamespace()
1404 JSTaggedValue RuntimeStubs::RuntimeGetModuleNamespace(JSThread *thread, int32_t index, in RuntimeGetModuleNamespace() argument
1407 return ModuleValueAccessor::GetModuleNamespace(thread, index, jsFunc); in RuntimeGetModuleNamespace()
1410 JSTaggedValue RuntimeStubs::RuntimeGetModuleNamespace(JSThread *thread, JSTaggedValue localName) in RuntimeGetModuleNamespace() argument
1412 return DeprecatedModuleValueAccessor::GetModuleNamespace(thread, localName); in RuntimeGetModuleNamespace()
1415 JSTaggedValue RuntimeStubs::RuntimeGetModuleNamespace(JSThread *thread, JSTaggedValue localName, in RuntimeGetModuleNamespace() argument
1418 return DeprecatedModuleValueAccessor::GetModuleNamespace(thread, localName, jsFunc); in RuntimeGetModuleNamespace()
1421 void RuntimeStubs::RuntimeStModuleVar(JSThread *thread, int32_t index, JSTaggedValue value) in RuntimeStModuleVar() argument
1423 ModuleValueAccessor::StoreModuleValue(thread, index, value); in RuntimeStModuleVar()
1426 void RuntimeStubs::RuntimeStModuleVar(JSThread *thread, int32_t index, JSTaggedValue value, in RuntimeStModuleVar() argument
1429 ModuleValueAccessor::StoreModuleValue(thread, index, value, jsFunc); in RuntimeStModuleVar()
1432 void RuntimeStubs::RuntimeStModuleVar(JSThread *thread, JSTaggedValue key, JSTaggedValue value) in RuntimeStModuleVar() argument
1434 DeprecatedModuleValueAccessor::StoreModuleValue(thread, key, value); in RuntimeStModuleVar()
1437 void RuntimeStubs::RuntimeStModuleVar(JSThread *thread, JSTaggedValue key, JSTaggedValue value, in RuntimeStModuleVar() argument
1440 DeprecatedModuleValueAccessor::StoreModuleValue(thread, key, value, jsFunc); in RuntimeStModuleVar()
1443 JSTaggedValue RuntimeStubs::RuntimeLdLocalModuleVar(JSThread *thread, int32_t index) in RuntimeLdLocalModuleVar() argument
1445 return ModuleValueAccessor::GetModuleValueInner(thread, index); in RuntimeLdLocalModuleVar()
1448 inline JSTaggedValue RuntimeStubs::RuntimeLdLocalModuleVarWithModule(JSThread* thread, int32_t inde… in RuntimeLdLocalModuleVarWithModule() argument
1452 ModuleManager* mmgr = thread->GetModuleManager(); in RuntimeLdLocalModuleVarWithModule()
1457 return SourceTextModule::Cast(module)->GetModuleValue(thread, index, false); in RuntimeLdLocalModuleVarWithModule()
1460 JSTaggedValue RuntimeStubs::RuntimeLdLocalModuleVar(JSThread *thread, int32_t index, JSTaggedValue … in RuntimeLdLocalModuleVar() argument
1462 return ModuleValueAccessor::GetModuleValueInner(thread, index, jsFunc); in RuntimeLdLocalModuleVar()
1465 JSTaggedValue RuntimeStubs::RuntimeLdExternalModuleVar(JSThread *thread, int32_t index) in RuntimeLdExternalModuleVar() argument
1467 return ModuleValueAccessor::GetModuleValueOuter(thread, index); in RuntimeLdExternalModuleVar()
1470 inline JSTaggedValue RuntimeStubs::RuntimeLdExternalModuleVarWithModule(JSThread* thread, int32_t i… in RuntimeLdExternalModuleVarWithModule() argument
1474 ModuleManager* mmgr = thread->GetModuleManager(); in RuntimeLdExternalModuleVarWithModule()
1478 moduleHdl = JSHandle<JSTaggedValue>(thread, module); in RuntimeLdExternalModuleVarWithModule()
1480 return ModuleValueAccessor::GetModuleValueOuter(thread, index, moduleHdl); in RuntimeLdExternalModuleVarWithModule()
1483 JSTaggedValue RuntimeStubs::RuntimeLdSendableExternalModuleVar(JSThread *thread, int32_t index, JST… in RuntimeLdSendableExternalModuleVar() argument
1485 return ModuleValueAccessor::GetSendableModuleValueOuter(thread, index, jsFunc); in RuntimeLdSendableExternalModuleVar()
1488 JSTaggedValue RuntimeStubs::RuntimeLdSendableLocalModuleVar(JSThread* thread, int32_t index, JSTagg… in RuntimeLdSendableLocalModuleVar() argument
1490 return ModuleValueAccessor::GetSendableModuleValueInner(thread, index, jsFunc); in RuntimeLdSendableLocalModuleVar()
1493 JSTaggedValue RuntimeStubs::RuntimeLdExternalModuleVar(JSThread *thread, int32_t index, JSTaggedVal… in RuntimeLdExternalModuleVar() argument
1495 return ModuleValueAccessor::GetModuleValueOuter(thread, index, jsFunc); in RuntimeLdExternalModuleVar()
1498 JSTaggedValue RuntimeStubs::RuntimeLdLazyExternalModuleVar(JSThread *thread, int32_t index, JSTagge… in RuntimeLdLazyExternalModuleVar() argument
1500 return ModuleValueAccessor::GetLazyModuleValueOuter(thread, index, jsFunc); in RuntimeLdLazyExternalModuleVar()
1504 JSThread *thread, int32_t index, JSTaggedValue jsFunc) in RuntimeLdLazySendableExternalModuleVar() argument
1506 return ModuleValueAccessor::GetLazySendableModuleValueOuter(thread, index, jsFunc); in RuntimeLdLazySendableExternalModuleVar()
1509 JSTaggedValue RuntimeStubs::RuntimeLdModuleVar(JSThread *thread, JSTaggedValue key, bool inner) in RuntimeLdModuleVar() argument
1512 JSTaggedValue moduleValue = DeprecatedModuleValueAccessor::GetModuleValueInner(thread, key); in RuntimeLdModuleVar()
1516 return DeprecatedModuleValueAccessor::GetModuleValueOuter(thread, key); in RuntimeLdModuleVar()
1519 JSTaggedValue RuntimeStubs::RuntimeLdModuleVar(JSThread *thread, JSTaggedValue key, bool inner, in RuntimeLdModuleVar() argument
1523 …JSTaggedValue moduleValue = DeprecatedModuleValueAccessor::GetModuleValueInner(thread, key, jsFunc… in RuntimeLdModuleVar()
1527 return DeprecatedModuleValueAccessor::GetModuleValueOuter(thread, key, jsFunc); in RuntimeLdModuleVar()
1530 JSTaggedValue RuntimeStubs::RuntimeGetPropIterator(JSThread *thread, const JSHandle<JSTaggedValue> … in RuntimeGetPropIterator() argument
1532 JSHandle<JSForInIterator> iteratorHandle = JSObject::EnumerateObjectProperties(thread, value); in RuntimeGetPropIterator()
1533 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGetPropIterator()
1537 JSTaggedValue RuntimeStubs::RuntimeAsyncFunctionEnter(JSThread *thread) in RuntimeAsyncFunctionEnter() argument
1539 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeAsyncFunctionEnter()
1541 JSHandle<GlobalEnv> globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); in RuntimeAsyncFunctionEnter()
1545 if (thread->GetEcmaVM()->GetJSOptions().EnablePendingCheak()) { in RuntimeAsyncFunctionEnter()
1546 thread->GetEcmaVM()->InsertAsyncStackTrace(promiseObject); in RuntimeAsyncFunctionEnter()
1551 asyncFuncObj->SetPromise(thread, promiseObject); in RuntimeAsyncFunctionEnter()
1554 context->SetGeneratorObject(thread, asyncFuncObj); in RuntimeAsyncFunctionEnter()
1558 asyncFuncObj->SetGeneratorContext(thread, context); in RuntimeAsyncFunctionEnter()
1561 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAsyncFunctionEnter()
1565 JSTaggedValue RuntimeStubs::RuntimeGetIterator(JSThread *thread, const JSHandle<JSTaggedValue> &obj) in RuntimeGetIterator() argument
1567 EcmaVM *vm = thread->GetEcmaVM(); in RuntimeGetIterator()
1570 JSTaggedValue::GetProperty(thread, obj, env->GetIteratorSymbol()).GetValue(); in RuntimeGetIterator()
1571 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGetIterator()
1576 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeGetIterator()
1577 …EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, valuesFunc, obj, undefined… in RuntimeGetIterator()
1581 JSTaggedValue RuntimeStubs::RuntimeGetAsyncIterator(JSThread *thread, const JSHandle<JSTaggedValue>… in RuntimeGetAsyncIterator() argument
1583 JSHandle<JSTaggedValue> asyncit = JSIterator::GetAsyncIterator(thread, obj); in RuntimeGetAsyncIterator()
1584 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGetAsyncIterator()
1588 JSTaggedValue RuntimeStubs::RuntimeLdPrivateProperty(JSThread *thread, JSTaggedValue lexicalEnv, in RuntimeLdPrivateProperty() argument
1593 … currentLexicalEnv = LexicalEnv::Cast(currentLexicalEnv.GetTaggedObject())->GetParentEnv(thread); in RuntimeLdPrivateProperty()
1596 …JSTaggedValue key = LexicalEnv::Cast(currentLexicalEnv.GetTaggedObject())->GetProperties(thread, s… in RuntimeLdPrivateProperty()
1598 …JSHandle<JSTaggedValue> handleObj(thread, obj.IsJSProxy() ? JSProxy::Cast(obj)->GetPrivateField(th… in RuntimeLdPrivateProperty()
1599 JSHandle<JSTaggedValue> handleKey(thread, key); in RuntimeLdPrivateProperty()
1601 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeLdPrivateProperty()
1603 …EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, handleKey, handleObj, unde… in RuntimeLdPrivateProperty()
1605 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdPrivateProperty()
1608 PropertyDescriptor desc(thread); in RuntimeLdPrivateProperty()
1610 !JSTaggedValue::GetOwnProperty(thread, handleObj, handleKey, desc)) { in RuntimeLdPrivateProperty()
1611 …THROW_TYPE_ERROR_AND_RETURN(thread, "invalid or cannot find private key", JSTaggedValue::Exception… in RuntimeLdPrivateProperty()
1614 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdPrivateProperty()
1618 JSTaggedValue RuntimeStubs::RuntimeStPrivateProperty(JSThread *thread, JSTaggedValue lexicalEnv, in RuntimeStPrivateProperty() argument
1623 … currentLexicalEnv = LexicalEnv::Cast(currentLexicalEnv.GetTaggedObject())->GetParentEnv(thread); in RuntimeStPrivateProperty()
1626 …JSTaggedValue key = LexicalEnv::Cast(currentLexicalEnv.GetTaggedObject())->GetProperties(thread, s… in RuntimeStPrivateProperty()
1628 …JSHandle<JSTaggedValue> handleObj(thread, obj.IsJSProxy() ? JSProxy::Cast(obj)->GetPrivateField(th… in RuntimeStPrivateProperty()
1629 JSHandle<JSTaggedValue> handleKey(thread, key); in RuntimeStPrivateProperty()
1630 JSHandle<JSTaggedValue> handleValue(thread, value); in RuntimeStPrivateProperty()
1632 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeStPrivateProperty()
1634 …EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, handleKey, handleObj, unde… in RuntimeStPrivateProperty()
1635 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStPrivateProperty()
1638 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStPrivateProperty()
1641 PropertyDescriptor desc(thread); in RuntimeStPrivateProperty()
1643 !JSTaggedValue::GetOwnProperty(thread, handleObj, handleKey, desc)) { in RuntimeStPrivateProperty()
1644 …THROW_TYPE_ERROR_AND_RETURN(thread, "invalid or cannot find private key", JSTaggedValue::Exception… in RuntimeStPrivateProperty()
1647 bool res = JSTaggedValue::DefineOwnProperty(thread, handleObj, handleKey, desc); in RuntimeStPrivateProperty()
1648 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStPrivateProperty()
1652 JSTaggedValue RuntimeStubs::RuntimeTestIn(JSThread *thread, JSTaggedValue lexicalEnv, in RuntimeTestIn() argument
1656 …THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot use 'in' operator in Non-Object", JSTaggedValue::Excep… in RuntimeTestIn()
1660 … currentLexicalEnv = LexicalEnv::Cast(currentLexicalEnv.GetTaggedObject())->GetParentEnv(thread); in RuntimeTestIn()
1663 …JSTaggedValue key = LexicalEnv::Cast(currentLexicalEnv.GetTaggedObject())->GetProperties(thread, s… in RuntimeTestIn()
1664 …JSHandle<JSTaggedValue> handleObj(thread, obj.IsJSProxy() ? JSProxy::Cast(obj)->GetPrivateField(th… in RuntimeTestIn()
1665 JSHandle<JSTaggedValue> handleKey(thread, key); in RuntimeTestIn()
1666 …bool res = JSTaggedValue::IsPropertyKey(handleKey) && JSTaggedValue::HasProperty(thread, handleObj… in RuntimeTestIn()
1667 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeTestIn()
1671 void RuntimeStubs::RuntimeThrow(JSThread *thread, JSTaggedValue value) in RuntimeThrow() argument
1673 thread->SetException(value); in RuntimeThrow()
1676 void RuntimeStubs::RuntimeThrowThrowNotExists(JSThread *thread) in RuntimeThrowThrowNotExists() argument
1678 THROW_TYPE_ERROR(thread, "Throw method is not defined"); in RuntimeThrowThrowNotExists()
1681 void RuntimeStubs::RuntimeThrowPatternNonCoercible(JSThread *thread) in RuntimeThrowPatternNonCoercible() argument
1683 JSHandle<EcmaString> msg(thread->GlobalConstants()->GetHandledObjNotCoercibleString()); in RuntimeThrowPatternNonCoercible()
1684 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeThrowPatternNonCoercible()
1685 THROW_NEW_ERROR_AND_RETURN(thread, in RuntimeThrowPatternNonCoercible()
1689 void RuntimeStubs::RuntimeThrowDeleteSuperProperty(JSThread *thread) in RuntimeThrowDeleteSuperProperty() argument
1691 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeThrowDeleteSuperProperty()
1694 THROW_NEW_ERROR_AND_RETURN(thread, errorObj.GetTaggedValue()); in RuntimeThrowDeleteSuperProperty()
1697 void RuntimeStubs::RuntimeThrowUndefinedIfHole(JSThread *thread, const JSHandle<EcmaString> &obj) in RuntimeThrowUndefinedIfHole() argument
1699 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeThrowUndefinedIfHole()
1700 JSHandle<EcmaString> info(thread->GlobalConstants()->GetHandledNotInitializedString()); in RuntimeThrowUndefinedIfHole()
1703 THROW_NEW_ERROR_AND_RETURN(thread, factory->NewJSError(base::ErrorType::REFERENCE_ERROR, in RuntimeThrowUndefinedIfHole()
1707 void RuntimeStubs::RuntimeThrowIfNotObject(JSThread *thread) in RuntimeThrowIfNotObject() argument
1709 THROW_TYPE_ERROR(thread, "Inner return result is not object"); in RuntimeThrowIfNotObject()
1712 void RuntimeStubs::RuntimeThrowConstAssignment(JSThread *thread, const JSHandle<EcmaString> &value) in RuntimeThrowConstAssignment() argument
1714 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeThrowConstAssignment()
1719 THROW_NEW_ERROR_AND_RETURN(thread, factory->NewJSError(base::ErrorType::TYPE_ERROR, in RuntimeThrowConstAssignment()
1723 JSTaggedValue RuntimeStubs::RuntimeLdGlobalRecord(JSThread *thread, JSTaggedValue key) in RuntimeLdGlobalRecord() argument
1725 EcmaVM *vm = thread->GetEcmaVM(); in RuntimeLdGlobalRecord()
1728 int entry = dict->FindEntry(thread, key); in RuntimeLdGlobalRecord()
1730 return JSTaggedValue(dict->GetBox(thread, entry)); in RuntimeLdGlobalRecord()
1735 JSTaggedValue RuntimeStubs::RuntimeTryLdGlobalByName(JSThread *thread, const JSHandle<JSTaggedValue… in RuntimeTryLdGlobalByName() argument
1738 OperationResult res = JSTaggedValue::GetProperty(thread, obj, prop); in RuntimeTryLdGlobalByName()
1739 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeTryLdGlobalByName()
1741 return RuntimeThrowReferenceError(thread, prop, " is not defined"); in RuntimeTryLdGlobalByName()
1746 JSTaggedValue RuntimeStubs::RuntimeTryUpdateGlobalRecord(JSThread *thread, JSTaggedValue prop, in RuntimeTryUpdateGlobalRecord() argument
1749 EcmaVM *vm = thread->GetEcmaVM(); in RuntimeTryUpdateGlobalRecord()
1752 int entry = dict->FindEntry(thread, prop); in RuntimeTryUpdateGlobalRecord()
1755 if (dict->GetAttributes(thread, entry).IsConstProps()) { in RuntimeTryUpdateGlobalRecord()
1756 return RuntimeThrowTypeError(thread, "const variable can not be modified"); in RuntimeTryUpdateGlobalRecord()
1759 PropertyBox *box = dict->GetBox(thread, entry); in RuntimeTryUpdateGlobalRecord()
1760 box->SetValue(thread, value); in RuntimeTryUpdateGlobalRecord()
1761 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeTryUpdateGlobalRecord()
1765 JSTaggedValue RuntimeStubs::RuntimeThrowReferenceError(JSThread *thread, const JSHandle<JSTaggedVal… in RuntimeThrowReferenceError() argument
1768 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeThrowReferenceError()
1769 JSHandle<EcmaString> propName = JSTaggedValue::ToString(thread, prop); in RuntimeThrowReferenceError()
1770 ASSERT_NO_ABRUPT_COMPLETION(thread); in RuntimeThrowReferenceError()
1773 THROW_NEW_ERROR_AND_RETURN_VALUE(thread, in RuntimeThrowReferenceError()
1778 JSTaggedValue RuntimeStubs::RuntimeLdGlobalVarFromProto(JSThread *thread, const JSHandle<JSTaggedVa… in RuntimeLdGlobalVarFromProto() argument
1783 JSHandle<JSTaggedValue> obj(thread, JSObject::GetPrototype(thread, global)); in RuntimeLdGlobalVarFromProto()
1784 OperationResult res = JSTaggedValue::GetProperty(thread, obj, prop); in RuntimeLdGlobalVarFromProto()
1785 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLdGlobalVarFromProto()
1789 JSTaggedValue RuntimeStubs::RuntimeStGlobalVar(JSThread *thread, const JSHandle<JSTaggedValue> &pro… in RuntimeStGlobalVar() argument
1792 JSHandle<JSTaggedValue> global(thread, thread->GetEcmaVM()->GetGlobalEnv()->GetGlobalObject()); in RuntimeStGlobalVar()
1794 JSObject::GlobalSetProperty(thread, prop, value, true); in RuntimeStGlobalVar()
1795 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeStGlobalVar()
1799 JSTaggedValue RuntimeStubs::RuntimeToNumber(JSThread *thread, const JSHandle<JSTaggedValue> &value) in RuntimeToNumber() argument
1801 return JSTaggedValue::ToNumber(thread, value); in RuntimeToNumber()
1804 JSTaggedValue RuntimeStubs::RuntimeToNumeric(JSThread *thread, const JSHandle<JSTaggedValue> &value) in RuntimeToNumeric() argument
1806 return JSTaggedValue::ToNumeric(thread, value).GetTaggedValue(); in RuntimeToNumeric()
1809 JSTaggedValue RuntimeStubs::RuntimeDynamicImport(JSThread *thread, const JSHandle<JSTaggedValue> &s… in RuntimeDynamicImport() argument
1812 EcmaVM *ecmaVm = thread->GetEcmaVM(); in RuntimeDynamicImport()
1818 const JSPandaFile *jsPandaFile = function->GetCallTarget(thread)->GetJSPandaFile(thread); in RuntimeDynamicImport()
1822 JSMutableHandle<JSTaggedValue> dirPath(thread, thread->GlobalConstants()->GetUndefined()); in RuntimeDynamicImport()
1823 JSMutableHandle<JSTaggedValue> recordName(thread, thread->GlobalConstants()->GetUndefined()); in RuntimeDynamicImport()
1827 recordName.Update(factory->NewFromUtf8(function->GetRecordName(thread))); in RuntimeDynamicImport()
1833 …JSHandle<PromiseCapability> promiseCapability = JSPromise::NewPromiseCapability(thread, promiseFun… in RuntimeDynamicImport()
1834 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeDynamicImport()
1838 argv->Set(thread, 0, promiseCapability->GetResolve(thread)); in RuntimeDynamicImport()
1839 argv->Set(thread, 1, promiseCapability->GetReject(thread)); // 1 : reject method in RuntimeDynamicImport()
1840 …argv->Set(thread, 2, dirPath); // 2 : current file path(containing file … in RuntimeDynamicImport()
1841 argv->Set(thread, 3, specifier); // 3 : request module's path in RuntimeDynamicImport()
1842 argv->Set(thread, 4, recordName); // 4 : js recordName or undefined in RuntimeDynamicImport()
1845 …job::MicroJobQueue::EnqueueJob(thread, job, job::QueueType::QUEUE_PROMISE, dynamicImportJob, argv); in RuntimeDynamicImport()
1847 return promiseCapability->GetPromise(thread); in RuntimeDynamicImport()
1850 JSTaggedValue RuntimeStubs::RuntimeEq(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeEq() argument
1853 bool ret = JSTaggedValue::Equal(thread, left, right); in RuntimeEq()
1854 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeEq()
1858 JSTaggedValue RuntimeStubs::RuntimeNotEq(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeNotEq() argument
1861 bool ret = JSTaggedValue::Equal(thread, left, right); in RuntimeNotEq()
1862 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeNotEq()
1866 JSTaggedValue RuntimeStubs::RuntimeLess(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeLess() argument
1869 bool ret = JSTaggedValue::Compare(thread, left, right) == ComparisonResult::LESS; in RuntimeLess()
1870 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLess()
1874 JSTaggedValue RuntimeStubs::RuntimeLessEq(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeLessEq() argument
1877 bool ret = JSTaggedValue::Compare(thread, left, right) <= ComparisonResult::EQUAL; in RuntimeLessEq()
1878 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeLessEq()
1882 JSTaggedValue RuntimeStubs::RuntimeGreater(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeGreater() argument
1885 bool ret = JSTaggedValue::Compare(thread, left, right) == ComparisonResult::GREAT; in RuntimeGreater()
1886 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGreater()
1890 JSTaggedValue RuntimeStubs::RuntimeGreaterEq(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeGreaterEq() argument
1893 ComparisonResult comparison = JSTaggedValue::Compare(thread, left, right); in RuntimeGreaterEq()
1895 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGreaterEq()
1899 JSTaggedValue RuntimeStubs::RuntimeAdd2(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeAdd2() argument
1904 thread->GetEcmaVM(), JSHandle<EcmaString>(left), JSHandle<EcmaString>(right)); in RuntimeAdd2()
1905 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAdd2()
1908 JSHandle<JSTaggedValue> primitiveA0(thread, JSTaggedValue::ToPrimitive(thread, left)); in RuntimeAdd2()
1909 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAdd2()
1910 JSHandle<JSTaggedValue> primitiveA1(thread, JSTaggedValue::ToPrimitive(thread, right)); in RuntimeAdd2()
1911 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAdd2()
1914 JSHandle<EcmaString> stringA0 = JSTaggedValue::ToString(thread, primitiveA0); in RuntimeAdd2()
1915 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAdd2()
1916 JSHandle<EcmaString> stringA1 = JSTaggedValue::ToString(thread, primitiveA1); in RuntimeAdd2()
1917 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAdd2()
1918 EcmaString *resultStr = EcmaStringAccessor::Concat(thread->GetEcmaVM(), stringA0, stringA1); in RuntimeAdd2()
1919 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAdd2()
1922 JSHandle<JSTaggedValue> valLeft = JSTaggedValue::ToNumeric(thread, primitiveA0); in RuntimeAdd2()
1923 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAdd2()
1924 JSHandle<JSTaggedValue> valRight = JSTaggedValue::ToNumeric(thread, primitiveA1); in RuntimeAdd2()
1925 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAdd2()
1930 return BigInt::Add(thread, bigLeft, bigRight).GetTaggedValue(); in RuntimeAdd2()
1932 …return RuntimeThrowTypeError(thread, "Cannot mix BigInt and other types, use explicit conversions"… in RuntimeAdd2()
1939 JSTaggedValue RuntimeStubs::RuntimeShl2(JSThread *thread, in RuntimeShl2() argument
1943 JSHandle<JSTaggedValue> leftValue = JSTaggedValue::ToNumeric(thread, left); in RuntimeShl2()
1944 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeShl2()
1945 JSHandle<JSTaggedValue> rightValue = JSTaggedValue::ToNumeric(thread, right); in RuntimeShl2()
1946 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeShl2()
1951 return BigInt::LeftShift(thread, leftBigint, rightBigint).GetTaggedValue(); in RuntimeShl2()
1953 …return RuntimeThrowTypeError(thread, "Cannot mix BigInt and other types, use explicit conversions"… in RuntimeShl2()
1955 JSTaggedValue taggedNumber0 = RuntimeToJSTaggedValueWithInt32(thread, leftValue); in RuntimeShl2()
1956 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeShl2()
1957 JSTaggedValue taggedNumber1 = RuntimeToJSTaggedValueWithInt32(thread, rightValue); in RuntimeShl2()
1958 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeShl2()
1969 JSTaggedValue RuntimeStubs::RuntimeShr2(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeShr2() argument
1972 JSHandle<JSTaggedValue> valLeft = JSTaggedValue::ToNumeric(thread, left); in RuntimeShr2()
1973 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeShr2()
1974 JSHandle<JSTaggedValue> valRight = JSTaggedValue::ToNumeric(thread, right); in RuntimeShr2()
1975 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeShr2()
1978 return BigInt::UnsignedRightShift(thread); in RuntimeShr2()
1980 …return RuntimeThrowTypeError(thread, "Cannot mix BigInt and other types, use explicit conversions"… in RuntimeShr2()
1982 JSTaggedValue taggedNumber0 = RuntimeToJSTaggedValueWithInt32(thread, valLeft); in RuntimeShr2()
1983 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeShr2()
1984 JSTaggedValue taggedNumber1 = RuntimeToJSTaggedValueWithInt32(thread, valRight); in RuntimeShr2()
1985 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeShr2()
1995 JSTaggedValue RuntimeStubs::RuntimeSub2(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeSub2() argument
1998 JSHandle<JSTaggedValue> valLeft = JSTaggedValue::ToNumeric(thread, left); in RuntimeSub2()
1999 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSub2()
2000 JSHandle<JSTaggedValue> valRight = JSTaggedValue::ToNumeric(thread, right); in RuntimeSub2()
2001 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSub2()
2006 return BigInt::Subtract(thread, bigLeft, bigRight).GetTaggedValue(); in RuntimeSub2()
2008 …return RuntimeThrowTypeError(thread, "Cannot mix BigInt and other types, use explicit conversions"… in RuntimeSub2()
2015 JSTaggedValue RuntimeStubs::RuntimeMul2(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeMul2() argument
2018 JSHandle<JSTaggedValue> valLeft = JSTaggedValue::ToNumeric(thread, left); in RuntimeMul2()
2019 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeMul2()
2020 JSHandle<JSTaggedValue> valRight = JSTaggedValue::ToNumeric(thread, right); in RuntimeMul2()
2021 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeMul2()
2027 return BigInt::Multiply(thread, bigLeft, bigRight).GetTaggedValue(); in RuntimeMul2()
2029 …return RuntimeThrowTypeError(thread, "Cannot mix BigInt and other types, use explicit conversions"… in RuntimeMul2()
2037 JSTaggedValue RuntimeStubs::RuntimeDiv2(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeDiv2() argument
2040 JSHandle<JSTaggedValue> valLeft = JSTaggedValue::ToNumeric(thread, left); in RuntimeDiv2()
2041 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeDiv2()
2042 JSHandle<JSTaggedValue> valRight = JSTaggedValue::ToNumeric(thread, right); in RuntimeDiv2()
2043 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeDiv2()
2048 return BigInt::Divide(thread, bigLeft, bigRight).GetTaggedValue(); in RuntimeDiv2()
2050 …return RuntimeThrowTypeError(thread, "Cannot mix BigInt and other types, use explicit conversions"… in RuntimeDiv2()
2065 JSTaggedValue RuntimeStubs::RuntimeMod2(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeMod2() argument
2068 JSHandle<JSTaggedValue> valLeft = JSTaggedValue::ToNumeric(thread, left); in RuntimeMod2()
2069 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeMod2()
2070 JSHandle<JSTaggedValue> valRight = JSTaggedValue::ToNumeric(thread, right); in RuntimeMod2()
2071 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeMod2()
2078 return BigInt::Remainder(thread, leftBigint, rightBigint).GetTaggedValue(); in RuntimeMod2()
2080 …return RuntimeThrowTypeError(thread, "Cannot mix BigInt and other types, use explicit conversions"… in RuntimeMod2()
2094 JSTaggedValue RuntimeStubs::RuntimeAshr2(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeAshr2() argument
2097 JSHandle<JSTaggedValue> valLeft = JSTaggedValue::ToNumeric(thread, left); in RuntimeAshr2()
2098 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAshr2()
2099 JSHandle<JSTaggedValue> valRight = JSTaggedValue::ToNumeric(thread, right); in RuntimeAshr2()
2100 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAshr2()
2105 return BigInt::SignedRightShift(thread, bigLeft, bigRight).GetTaggedValue(); in RuntimeAshr2()
2107 …return RuntimeThrowTypeError(thread, "Cannot mix BigInt and other types, use explicit conversions"… in RuntimeAshr2()
2109 JSTaggedValue taggedNumber0 = RuntimeToJSTaggedValueWithInt32(thread, valLeft); in RuntimeAshr2()
2110 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAshr2()
2111 JSTaggedValue taggedNumber1 = RuntimeToJSTaggedValueWithInt32(thread, valRight); in RuntimeAshr2()
2112 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAshr2()
2120 JSTaggedValue RuntimeStubs::RuntimeAnd2(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeAnd2() argument
2123 JSHandle<JSTaggedValue> valLeft = JSTaggedValue::ToNumeric(thread, left); in RuntimeAnd2()
2124 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAnd2()
2125 JSHandle<JSTaggedValue> valRight = JSTaggedValue::ToNumeric(thread, right); in RuntimeAnd2()
2126 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAnd2()
2131 return BigInt::BitwiseAND(thread, leftBigint, rightBigint).GetTaggedValue(); in RuntimeAnd2()
2133 …return RuntimeThrowTypeError(thread, "Cannot mix BigInt and other types, use explicit conversions"… in RuntimeAnd2()
2135 JSTaggedValue taggedNumber0 = RuntimeToJSTaggedValueWithInt32(thread, valLeft); in RuntimeAnd2()
2136 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAnd2()
2137 JSTaggedValue taggedNumber1 = RuntimeToJSTaggedValueWithInt32(thread, valRight); in RuntimeAnd2()
2138 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeAnd2()
2146 JSTaggedValue RuntimeStubs::RuntimeOr2(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeOr2() argument
2149 JSHandle<JSTaggedValue> valLeft = JSTaggedValue::ToNumeric(thread, left); in RuntimeOr2()
2150 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOr2()
2151 JSHandle<JSTaggedValue> valRight = JSTaggedValue::ToNumeric(thread, right); in RuntimeOr2()
2152 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOr2()
2157 return BigInt::BitwiseOR(thread, leftBigint, rightBigint).GetTaggedValue(); in RuntimeOr2()
2159 …return RuntimeThrowTypeError(thread, "Cannot mix BigInt and other types, use explicit conversions"… in RuntimeOr2()
2161 JSTaggedValue taggedNumber0 = RuntimeToJSTaggedValueWithInt32(thread, valLeft); in RuntimeOr2()
2162 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOr2()
2163 JSTaggedValue taggedNumber1 = RuntimeToJSTaggedValueWithInt32(thread, valRight); in RuntimeOr2()
2164 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOr2()
2172 JSTaggedValue RuntimeStubs::RuntimeXor2(JSThread *thread, const JSHandle<JSTaggedValue> &left, in RuntimeXor2() argument
2175 JSHandle<JSTaggedValue> valLeft = JSTaggedValue::ToNumeric(thread, left); in RuntimeXor2()
2176 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeXor2()
2177 JSHandle<JSTaggedValue> valRight = JSTaggedValue::ToNumeric(thread, right); in RuntimeXor2()
2178 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeXor2()
2183 return BigInt::BitwiseXOR(thread, leftBigint, rightBigint).GetTaggedValue(); in RuntimeXor2()
2185 …return RuntimeThrowTypeError(thread, "Cannot mix BigInt and other types, use explicit conversions"… in RuntimeXor2()
2187 JSTaggedValue taggedNumber0 = RuntimeToJSTaggedValueWithInt32(thread, valLeft); in RuntimeXor2()
2188 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeXor2()
2189 JSTaggedValue taggedNumber1 = RuntimeToJSTaggedValueWithInt32(thread, valRight); in RuntimeXor2()
2190 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeXor2()
2198 JSTaggedValue RuntimeStubs::RuntimeToJSTaggedValueWithInt32(JSThread *thread, in RuntimeToJSTaggedValueWithInt32() argument
2201 int32_t res = JSTaggedValue::ToInt32(thread, value); in RuntimeToJSTaggedValueWithInt32()
2202 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeToJSTaggedValueWithInt32()
2206 JSTaggedValue RuntimeStubs::RuntimeToJSTaggedValueWithUint32(JSThread *thread, const JSHandle<JSTag… in RuntimeToJSTaggedValueWithUint32() argument
2208 uint32_t res = JSTaggedValue::ToUint32(thread, value); in RuntimeToJSTaggedValueWithUint32()
2209 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeToJSTaggedValueWithUint32()
2213 JSTaggedValue RuntimeStubs::RuntimeCreateEmptyObject([[maybe_unused]] JSThread *thread, ObjectFacto… in RuntimeCreateEmptyObject() argument
2221 JSTaggedValue RuntimeStubs::RuntimeCreateEmptyArray([[maybe_unused]] JSThread *thread, ObjectFactor… in RuntimeCreateEmptyArray() argument
2229 JSTaggedValue RuntimeStubs::RuntimeGetUnmapedArgs(JSThread *thread, JSTaggedType *sp, uint32_t actu… in RuntimeGetUnmapedArgs() argument
2232 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeGetUnmapedArgs()
2235 argumentsList->Set(thread, i, in RuntimeGetUnmapedArgs()
2238 return RuntimeGetUnmapedJSArgumentObj(thread, argumentsList); in RuntimeGetUnmapedArgs()
2241 JSTaggedValue RuntimeStubs::RuntimeCopyRestArgs(JSThread *thread, JSTaggedType *sp, uint32_t restNu… in RuntimeCopyRestArgs() argument
2245thread, restNumArgs, [thread, sp, startIdx] (const JSHandle<TaggedArray> &newElements, uint32_t le… in RuntimeCopyRestArgs()
2248 newElements->Set(thread, i, JSTaggedValue(sp[startIdx + i])); in RuntimeCopyRestArgs()
2253 JSTaggedValue RuntimeStubs::RuntimeCreateArrayWithBuffer(JSThread *thread, ObjectFactory *factory, in RuntimeCreateArrayWithBuffer() argument
2258 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCreateArrayWithBuffer()
2263 JSTaggedValue RuntimeStubs::RuntimeCreateObjectWithBuffer(JSThread *thread, ObjectFactory *factory, in RuntimeCreateObjectWithBuffer() argument
2267 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCreateObjectWithBuffer()
2272 JSTaggedValue RuntimeStubs::RuntimeNewLexicalEnv(JSThread *thread, uint16_t numVars) in RuntimeNewLexicalEnv() argument
2274 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeNewLexicalEnv()
2276 JSTaggedValue currentEnv = thread->GetCurrentLexenv(); in RuntimeNewLexicalEnv()
2278 JSTaggedValue globalEnv = BaseEnv::Cast(currentEnv.GetTaggedObject())->GetGlobalEnv(thread); in RuntimeNewLexicalEnv()
2280 newEnv->SetGlobalEnv(thread, globalEnv); in RuntimeNewLexicalEnv()
2282 newEnv->SetGlobalEnv(thread, thread->GetGlueGlobalEnv()); in RuntimeNewLexicalEnv()
2284 newEnv->SetParentEnv(thread, currentEnv); in RuntimeNewLexicalEnv()
2285 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeNewLexicalEnv()
2289 JSTaggedValue RuntimeStubs::RuntimeNewSendableEnv(JSThread *thread, uint16_t numVars) in RuntimeNewSendableEnv() argument
2291 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeNewSendableEnv()
2294 JSTaggedValue module = JSFunction::Cast(thread->GetCurrentFunction())->GetModule(thread); in RuntimeNewSendableEnv()
2295 JSHandle<SourceTextModule> moduleHandle(thread, module); in RuntimeNewSendableEnv()
2296 newEnv->SetParentEnv(thread, moduleHandle->GetSendableEnv(thread)); in RuntimeNewSendableEnv()
2297 newEnv->SetScopeInfo(thread, JSTaggedValue::Hole()); in RuntimeNewSendableEnv()
2298 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeNewSendableEnv()
2302 JSTaggedValue RuntimeStubs::RuntimeNewObjRange(JSThread *thread, const JSHandle<JSTaggedValue> &fun… in RuntimeNewObjRange() argument
2305 JSHandle<JSTaggedValue> preArgs(thread, JSTaggedValue::Undefined()); in RuntimeNewObjRange()
2306 JSHandle<TaggedArray> args = thread->GetEcmaVM()->GetFactory()->NewTaggedArray(length); in RuntimeNewObjRange()
2307 FrameHandler frameHandler(thread); in RuntimeNewObjRange()
2310 args->Set(thread, i, value); in RuntimeNewObjRange()
2312 auto tagged = RuntimeOptConstruct(thread, func, newTarget, preArgs, args); in RuntimeNewObjRange()
2313 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeNewObjRange()
2317 void RuntimeStubs::DumpInfoForMoreLdInfo(JSThread *thread, JSHandle<JSTaggedValue> &receiver, in DumpInfoForMoreLdInfo() argument
2337 auto AddDepth = [&thread, &msg] (JSHandle<JSTaggedValue> value) { in DumpInfoForMoreLdInfo()
2342 auto proto = currHC->GetProto(thread); in DumpInfoForMoreLdInfo()
2343 value = JSHandle<JSTaggedValue>(thread, proto); in DumpInfoForMoreLdInfo()
2358 void RuntimeStubs::DumpInfoForLdObjByValue(JSThread *thread, JSHandle<JSTaggedValue> &profile, JSTa… in DumpInfoForLdObjByValue() argument
2368 auto first = prof->GetIcSlot(thread, slot); in DumpInfoForLdObjByValue()
2376 auto second = prof->GetIcSlot(thread, slot + 1); in DumpInfoForLdObjByValue()
2402 void RuntimeStubs::DefineFuncTryUseAOTHClass(JSThread* thread, in DefineFuncTryUseAOTHClass() argument
2407 FunctionKind kind = Method::Cast(func->GetMethod(thread))->GetFunctionKind(); in DefineFuncTryUseAOTHClass()
2411 JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv(); in DefineFuncTryUseAOTHClass()
2412 const GlobalEnvConstants *globalConst = thread->GlobalConstants(); in DefineFuncTryUseAOTHClass()
2413 func->SetProtoOrHClass(thread, ihc); in DefineFuncTryUseAOTHClass()
2417 JSHandle<JSObject> clsPrototype(thread, func->GetFunctionPrototype(thread)); in DefineFuncTryUseAOTHClass()
2418 clsPrototype->GetClass()->SetPrototype(thread, parentPrototype); in DefineFuncTryUseAOTHClass()
2422 … PropertyDescriptor descriptor(thread, JSHandle<JSTaggedValue>::Cast(func), true, false, true); in DefineFuncTryUseAOTHClass()
2423 JSObject::DefineOwnProperty(thread, clsPrototype, constructorKey, descriptor); in DefineFuncTryUseAOTHClass()
2426 JSHClass::EnablePHCProtoChangeMarker(thread, in DefineFuncTryUseAOTHClass()
2427 JSHandle<JSHClass>(thread, parentPrototype->GetTaggedObject()->GetClass())); in DefineFuncTryUseAOTHClass()
2429 JSHClass::EnableProtoChangeMarker(thread, JSHandle<JSHClass>(ihc)); in DefineFuncTryUseAOTHClass()
2431 …JSHClass::EnablePHCProtoChangeMarker(thread, JSHandle<JSHClass>(thread, clsPrototype->GetClass())); in DefineFuncTryUseAOTHClass()
2433 //avoid one thread uses ihc twice or more times in DefineFuncTryUseAOTHClass()
2438 JSTaggedValue RuntimeStubs::RuntimeDefinefunc(JSThread *thread, const JSHandle<JSTaggedValue> &cons… in RuntimeDefinefunc() argument
2444 JSMutableHandle<JSTaggedValue> ihc(thread, JSTaggedValue::Undefined()); in RuntimeDefinefunc()
2445 JSMutableHandle<AOTLiteralInfo> aotLiteralInfo(thread, JSTaggedValue::Hole()); in RuntimeDefinefunc()
2449 …JSTaggedValue unsharedCp = thread->GetEcmaVM()->FindUnsharedConstpool(constpoolHandle.GetTaggedVal… in RuntimeDefinefunc()
2451 JSHandle<ConstantPool> unsharedCpHandle(thread, unsharedCp); in RuntimeDefinefunc()
2452 JSTaggedValue val = unsharedCpHandle->GetObjectFromCache(thread, methodId); in RuntimeDefinefunc()
2455 ihc.Update(aotLiteralInfo->GetIhc(thread)); in RuntimeDefinefunc()
2458 …JSTaggedValue method = ConstantPool::GetMethodFromCache(thread, constpoolHandle.GetTaggedValue(), … in RuntimeDefinefunc()
2459 const JSHandle<Method> methodHandle(thread, method); in RuntimeDefinefunc()
2460 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeDefinefunc()
2464 ModuleManager *moduleManager = thread->GetModuleManager(); in RuntimeDefinefunc()
2468 sendableFuncModuleRecord->SetSendableEnv(thread, in RuntimeDefinefunc()
2469 … JSHandle<SourceTextModule>::Cast(module)->GetSendableEnv(thread)); in RuntimeDefinefunc()
2471 result->SetModule(thread, sendableFuncModule.GetTaggedValue()); in RuntimeDefinefunc()
2472 auto globalConst = thread->GlobalConstants(); in RuntimeDefinefunc()
2474 result->SetLexicalEnv<SKIP_BARRIER>(thread, emptySFunctionEnvHandle.GetTaggedValue()); in RuntimeDefinefunc()
2477 result->SetModule(thread, module.GetTaggedValue()); in RuntimeDefinefunc()
2478 result->SetLexicalEnv(thread, envHandle.GetTaggedValue()); in RuntimeDefinefunc()
2479 result->SetHomeObject(thread, homeObject.GetTaggedValue()); in RuntimeDefinefunc()
2481 DefineFuncTryUseAOTHClass(thread, result, ihc, aotLiteralInfo); in RuntimeDefinefunc()
2487 JSTaggedValue RuntimeStubs::RuntimeCreateRegExpWithLiteral(JSThread *thread, in RuntimeCreateRegExpWithLiteral() argument
2490 JSHandle<JSTaggedValue> flagsHandle(thread, JSTaggedValue(flags)); in RuntimeCreateRegExpWithLiteral()
2491 return builtins::BuiltinsRegExp::RegExpCreate(thread, pattern, flagsHandle); in RuntimeCreateRegExpWithLiteral()
2494 JSTaggedValue RuntimeStubs::RuntimeThrowIfSuperNotCorrectCall(JSThread *thread, uint16_t index, in RuntimeThrowIfSuperNotCorrectCall() argument
2498 …return RuntimeThrowReferenceError(thread, JSHandle<JSTaggedValue>(thread, JSTaggedValue::Undefined… in RuntimeThrowIfSuperNotCorrectCall()
2502 …return RuntimeThrowReferenceError(thread, JSHandle<JSTaggedValue>(thread, JSTaggedValue::Undefined… in RuntimeThrowIfSuperNotCorrectCall()
2508 JSTaggedValue RuntimeStubs::RuntimeCreateObjectHavingMethod(JSThread *thread, ObjectFactory *factor… in RuntimeCreateObjectHavingMethod() argument
2513 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCreateObjectHavingMethod()
2518 JSTaggedValue RuntimeStubs::CommonCreateObjectWithExcludedKeys(JSThread *thread, in CommonCreateObjectWithExcludedKeys() argument
2523 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in CommonCreateObjectWithExcludedKeys()
2528 JSHandle<JSObject> obj(JSTaggedValue::ToObject(thread, objVal)); in CommonCreateObjectWithExcludedKeys()
2529 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in CommonCreateObjectWithExcludedKeys()
2530 JSHandle<TaggedArray> allKeys = JSObject::GetOwnPropertyKeys(thread, obj); in CommonCreateObjectWithExcludedKeys()
2532 JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined()); in CommonCreateObjectWithExcludedKeys()
2534 key.Update(allKeys->Get(thread, i)); in CommonCreateObjectWithExcludedKeys()
2537 …if (JSTaggedValue::Equal(thread, key, JSHandle<JSTaggedValue>(thread, excludedKeys->Get(thread, j)… in CommonCreateObjectWithExcludedKeys()
2543 PropertyDescriptor desc(thread); in CommonCreateObjectWithExcludedKeys()
2544 bool success = JSObject::GetOwnProperty(thread, obj, key, desc); in CommonCreateObjectWithExcludedKeys()
2545 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in CommonCreateObjectWithExcludedKeys()
2547 JSHandle<JSTaggedValue> value = JSObject::GetProperty(thread, obj, key).GetValue(); in CommonCreateObjectWithExcludedKeys()
2548 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in CommonCreateObjectWithExcludedKeys()
2549 JSObject::SetProperty(thread, restObj, key, value, true); in CommonCreateObjectWithExcludedKeys()
2550 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in CommonCreateObjectWithExcludedKeys()
2557 JSTaggedValue RuntimeStubs::RuntimeOptCreateObjectWithExcludedKeys(JSThread *thread, uintptr_t argv… in RuntimeOptCreateObjectWithExcludedKeys() argument
2559 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeOptCreateObjectWithExcludedKeys()
2568 excludedKeys->Set(thread, 0, excludedKey); in RuntimeOptCreateObjectWithExcludedKeys()
2571 excludedKeys->Set(thread, i, excludedKey); in RuntimeOptCreateObjectWithExcludedKeys()
2574 return CommonCreateObjectWithExcludedKeys(thread, objVal, numExcludedKeys, excludedKeys); in RuntimeOptCreateObjectWithExcludedKeys()
2577 JSTaggedValue RuntimeStubs::RuntimeCreateObjectWithExcludedKeys(JSThread *thread, uint16_t numKeys, in RuntimeCreateObjectWithExcludedKeys() argument
2581 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeCreateObjectWithExcludedKeys()
2584 FrameHandler frameHandler(thread); in RuntimeCreateObjectWithExcludedKeys()
2588 excludedKeys->Set(thread, 0, excludedKey); in RuntimeCreateObjectWithExcludedKeys()
2591 excludedKeys->Set(thread, i, excludedKey); in RuntimeCreateObjectWithExcludedKeys()
2597 JSHandle<JSProxy> proxyVal(thread, finalVal.GetTaggedValue()); in RuntimeCreateObjectWithExcludedKeys()
2598 finalVal = proxyVal->GetSourceTarget(thread); in RuntimeCreateObjectWithExcludedKeys()
2601 return CommonCreateObjectWithExcludedKeys(thread, finalVal, numExcludedKeys, excludedKeys); in RuntimeCreateObjectWithExcludedKeys()
2604 JSTaggedValue RuntimeStubs::RuntimeDefineMethod(JSThread *thread, const JSHandle<Method> &methodHan… in RuntimeDefineMethod() argument
2609 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeDefineMethod()
2612 func->SetLexicalEnv(thread, env); in RuntimeDefineMethod()
2613 func->SetModule(thread, module); in RuntimeDefineMethod()
2617 JSTaggedValue RuntimeStubs::RuntimeLdSendableClass(JSThread *thread, const JSHandle<JSTaggedValue> … in RuntimeLdSendableClass() argument
2622 currentEnv = LexicalEnv::Cast(currentEnv.GetTaggedObject())->GetParentEnv(thread); in RuntimeLdSendableClass()
2625 return SFunctionEnv::Cast(currentEnv.GetTaggedObject())->GetConstructor(thread); in RuntimeLdSendableClass()
2628 JSTaggedValue RuntimeStubs::RuntimeCallSpread(JSThread *thread, in RuntimeCallSpread() argument
2634 THROW_TYPE_ERROR_AND_RETURN(thread, "cannot Callspread", JSTaggedValue::Exception()); in RuntimeCallSpread()
2637 JSHandle<TaggedArray> coretypesArray(thread, RuntimeGetCallSpreadArgs(thread, array)); in RuntimeCallSpread()
2638 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCallSpread()
2640 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeCallSpread()
2641 …EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, func, obj, undefined, leng… in RuntimeCallSpread()
2642 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCallSpread()
2647 void RuntimeStubs::RuntimeSetPatchModule(JSThread *thread, const JSHandle<JSFunction> &func) in RuntimeSetPatchModule() argument
2649 JSHandle<Method> methodHandle(thread, Method::Cast(func->GetMethod(thread))); in RuntimeSetPatchModule()
2650 const JSHandle<JSTaggedValue> coldReloadRecordName = thread->GetEcmaVM()->FindPatchModule( in RuntimeSetPatchModule()
2651 … MethodLiteral::GetRecordName(methodHandle->GetJSPandaFile(thread), methodHandle->GetMethodId())); in RuntimeSetPatchModule()
2653 func->SetModule(thread, coldReloadRecordName.GetTaggedValue()); in RuntimeSetPatchModule()
2657 JSTaggedValue RuntimeStubs::RuntimeDefineGetterSetterByValue(JSThread *thread, const JSHandle<JSObj… in RuntimeDefineGetterSetterByValue() argument
2664 JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, prop); in RuntimeDefineGetterSetterByValue()
2665 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeDefineGetterSetterByValue()
2666 auto globalConst = thread->GlobalConstants(); in RuntimeDefineGetterSetterByValue()
2668 JSTaggedValue::SameValue(thread, propKey, globalConst->GetHandledPrototypeString())) { in RuntimeDefineGetterSetterByValue()
2670 thread, in RuntimeDefineGetterSetterByValue()
2680 …JSHandle<JSTaggedValue>::Cast(base::NumberHelper::NumberToString(thread, propKey.GetTaggedValue())… in RuntimeDefineGetterSetterByValue()
2682 JSFunctionBase::SetFunctionName(thread, JSHandle<JSFunctionBase>::Cast(getter), propKey, in RuntimeDefineGetterSetterByValue()
2683 … JSHandle<JSTaggedValue>(thread, globalConst->GetGetString())); in RuntimeDefineGetterSetterByValue()
2689 …JSHandle<JSTaggedValue>::Cast(base::NumberHelper::NumberToString(thread, propKey.GetTaggedValue())… in RuntimeDefineGetterSetterByValue()
2691 JSFunctionBase::SetFunctionName(thread, JSHandle<JSFunctionBase>::Cast(setter), propKey, in RuntimeDefineGetterSetterByValue()
2692 … JSHandle<JSTaggedValue>(thread, globalConst->GetSetString())); in RuntimeDefineGetterSetterByValue()
2699 PropertyDescriptor desc(thread, true, enumerable, true); in RuntimeDefineGetterSetterByValue()
2701 …Method *method = Method::Cast(JSHandle<JSFunction>::Cast(getter)->GetMethod(thread).GetTaggedObjec… in RuntimeDefineGetterSetterByValue()
2706 …Method *method = Method::Cast(JSHandle<JSFunction>::Cast(setter)->GetMethod(thread).GetTaggedObjec… in RuntimeDefineGetterSetterByValue()
2711 JSObject::DefineOwnProperty(thread, obj, propKey, desc); in RuntimeDefineGetterSetterByValue()
2715 JSHandle<JSHClass> phcHandle(thread, holderTraHClass); in RuntimeDefineGetterSetterByValue()
2716 JSHClass::EnablePHCProtoChangeMarker(thread, phcHandle); in RuntimeDefineGetterSetterByValue()
2718 if (thread->GetEcmaVM()->IsEnablePGOProfiler()) { in RuntimeDefineGetterSetterByValue()
2720 thread->GetEcmaVM()->GetPGOProfiler()->ProfileDefineGetterSetter( in RuntimeDefineGetterSetterByValue()
2728 JSTaggedValue RuntimeStubs::RuntimeSuperCall(JSThread *thread, const JSHandle<JSTaggedValue> &func, in RuntimeSuperCall() argument
2732 JSHandle<JSTaggedValue> superFunc(thread, JSTaggedValue::GetPrototype(thread, func)); in RuntimeSuperCall()
2733 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSuperCall()
2735 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeSuperCall()
2737 FrameHandler frameHandler(thread); in RuntimeSuperCall()
2739 argv->Set(thread, i, frameHandler.GetVRegValue(firstVRegIdx + i)); in RuntimeSuperCall()
2742 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeSuperCall()
2743 …EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, superFunc, undefined, newT… in RuntimeSuperCall()
2744 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSuperCall()
2747 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeSuperCall()
2752 JSTaggedValue RuntimeStubs::RuntimeOptSuperCall(JSThread *thread, const JSHandle<JSTaggedValue> &fu… in RuntimeOptSuperCall() argument
2757 JSHandle<JSTaggedValue> superFunc(thread, JSTaggedValue::GetPrototype(thread, func)); in RuntimeOptSuperCall()
2758 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptSuperCall()
2759 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeOptSuperCall()
2760 …EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, superFunc, undefined, newT… in RuntimeOptSuperCall()
2761 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptSuperCall()
2764 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptSuperCall()
2768 JSTaggedValue RuntimeStubs::RuntimeThrowTypeError(JSThread *thread, const char *message) in RuntimeThrowTypeError() argument
2770 ASSERT_NO_ABRUPT_COMPLETION(thread); in RuntimeThrowTypeError()
2771 THROW_TYPE_ERROR_AND_RETURN(thread, message, JSTaggedValue::Exception()); in RuntimeThrowTypeError()
2774 JSTaggedValue RuntimeStubs::RuntimeGetCallSpreadArgs(JSThread *thread, const JSHandle<JSTaggedValue… in RuntimeGetCallSpreadArgs() argument
2778 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeGetCallSpreadArgs()
2780 JSHandle<JSTaggedValue> itor = JSIterator::GetIterator(thread, jsArray); in RuntimeGetCallSpreadArgs()
2781 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGetCallSpreadArgs()
2784 if (jsArray->IsStableJSArray(thread) && itor->IsJSArrayIterator()) { in RuntimeGetCallSpreadArgs()
2786 ElementAccessor::CopyJSArrayToTaggedArray(thread, jsArrayObj, argv, argvMayMaxLength); in RuntimeGetCallSpreadArgs()
2790 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGetCallSpreadArgs()
2791 JSMutableHandle<JSTaggedValue> next(thread, JSTaggedValue::Undefined()); in RuntimeGetCallSpreadArgs()
2792 JSMutableHandle<JSTaggedValue> nextArg(thread, JSTaggedValue::Undefined()); in RuntimeGetCallSpreadArgs()
2795 next.Update(JSIterator::IteratorStep(thread, itor).GetTaggedValue()); in RuntimeGetCallSpreadArgs()
2796 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGetCallSpreadArgs()
2797 if (JSTaggedValue::SameValue(thread, next.GetTaggedValue(), JSTaggedValue::False())) { in RuntimeGetCallSpreadArgs()
2800 nextArg.Update(JSIterator::IteratorValue(thread, next).GetTaggedValue()); in RuntimeGetCallSpreadArgs()
2801 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGetCallSpreadArgs()
2804 argv = argv->SetCapacity(thread, argv, argvMayMaxLength); in RuntimeGetCallSpreadArgs()
2806 argv->Set(thread, argvIndex++, nextArg); in RuntimeGetCallSpreadArgs()
2812 JSTaggedValue RuntimeStubs::RuntimeThrowSyntaxError(JSThread *thread, const char *message) in RuntimeThrowSyntaxError() argument
2814 ASSERT_NO_ABRUPT_COMPLETION(thread); in RuntimeThrowSyntaxError()
2815 THROW_SYNTAX_ERROR_AND_RETURN(thread, message, JSTaggedValue::Exception()); in RuntimeThrowSyntaxError()
2818 JSTaggedValue RuntimeStubs::RuntimeLdBigInt(JSThread *thread, const JSHandle<JSTaggedValue> &number… in RuntimeLdBigInt() argument
2820 return JSTaggedValue::ToBigInt(thread, numberBigInt); in RuntimeLdBigInt()
2823 JSTaggedValue RuntimeStubs::RuntimeCallBigIntAsIntN(JSThread *thread, JSTaggedValue bits, JSTaggedV… in RuntimeCallBigIntAsIntN() argument
2825 auto biginteger = JSHandle<BigInt>(thread, bigint); in RuntimeCallBigIntAsIntN()
2826 JSTaggedNumber bitness = JSTaggedValue::ToNumber(thread, bits); in RuntimeCallBigIntAsIntN()
2827 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCallBigIntAsIntN()
2828 return BigInt::AsintN(thread, bitness, biginteger); in RuntimeCallBigIntAsIntN()
2831 JSTaggedValue RuntimeStubs::RuntimeCallBigIntAsUintN(JSThread *thread, JSTaggedValue bits, JSTagged… in RuntimeCallBigIntAsUintN() argument
2833 auto biginteger = JSHandle<BigInt>(thread, bigint); in RuntimeCallBigIntAsUintN()
2834 JSTaggedNumber bitness = JSTaggedValue::ToNumber(thread, bits); in RuntimeCallBigIntAsUintN()
2835 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeCallBigIntAsUintN()
2836 return BigInt::AsUintN(thread, bitness, biginteger); in RuntimeCallBigIntAsUintN()
2839 JSTaggedValue RuntimeStubs::RuntimeNewLexicalEnvWithName(JSThread *thread, uint16_t numVars, uint16… in RuntimeNewLexicalEnvWithName() argument
2841 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeNewLexicalEnvWithName()
2843 JSTaggedValue currentEnv = thread->GetCurrentLexenv(); in RuntimeNewLexicalEnvWithName()
2845 JSTaggedValue globalEnv = BaseEnv::Cast(currentEnv.GetTaggedObject())->GetGlobalEnv(thread); in RuntimeNewLexicalEnvWithName()
2847 newEnv->SetGlobalEnv(thread, globalEnv); in RuntimeNewLexicalEnvWithName()
2849 newEnv->SetGlobalEnv(thread, thread->GetGlueGlobalEnv()); in RuntimeNewLexicalEnvWithName()
2851 newEnv->SetParentEnv(thread, currentEnv); in RuntimeNewLexicalEnvWithName()
2852 JSTaggedValue scopeInfo = ScopeInfoExtractor::GenerateScopeInfo(thread, scopeId); in RuntimeNewLexicalEnvWithName()
2853 newEnv->SetScopeInfo(thread, scopeInfo); in RuntimeNewLexicalEnvWithName()
2854 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeNewLexicalEnvWithName()
2858 JSTaggedValue RuntimeStubs::RuntimeOptGetUnmapedArgs(JSThread *thread, uint32_t actualNumArgs) in RuntimeOptGetUnmapedArgs() argument
2860 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeOptGetUnmapedArgs()
2863 auto argv = GetActualArgvFromStub(thread); in RuntimeOptGetUnmapedArgs()
2869 argumentsList->Set(thread, idx++, args); in RuntimeOptGetUnmapedArgs()
2871 return RuntimeGetUnmapedJSArgumentObj(thread, argumentsList); in RuntimeOptGetUnmapedArgs()
2874 JSTaggedValue RuntimeStubs::RuntimeGetUnmapedJSArgumentObj(JSThread *thread, const JSHandle<TaggedA… in RuntimeGetUnmapedJSArgumentObj() argument
2876 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeGetUnmapedJSArgumentObj()
2877 JSHandle<GlobalEnv> globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); in RuntimeGetUnmapedJSArgumentObj()
2887 thread, JSTaggedValue(len)); in RuntimeGetUnmapedJSArgumentObj()
2893 obj->SetElements(thread, argumentsList.GetTaggedValue()); in RuntimeGetUnmapedJSArgumentObj()
2898 thread, globalEnv->GetArrayProtoValuesFunction().GetTaggedValue()); in RuntimeGetUnmapedJSArgumentObj()
2903 thread, accessorCaller.GetTaggedValue()); in RuntimeGetUnmapedJSArgumentObj()
2908 thread, accessorCallee.GetTaggedValue()); in RuntimeGetUnmapedJSArgumentObj()
2909 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeGetUnmapedJSArgumentObj()
2914 JSTaggedValue RuntimeStubs::RuntimeOptNewLexicalEnvWithName(JSThread *thread, uint16_t numVars, uin… in RuntimeOptNewLexicalEnvWithName() argument
2918 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeOptNewLexicalEnvWithName()
2922 JSTaggedValue globalEnv = BaseEnv::Cast(obj)->GetGlobalEnv(thread); in RuntimeOptNewLexicalEnvWithName()
2924 newEnv->SetGlobalEnv(thread, globalEnv); in RuntimeOptNewLexicalEnvWithName()
2926 newEnv->SetGlobalEnv(thread, thread->GetGlueGlobalEnv()); in RuntimeOptNewLexicalEnvWithName()
2928 newEnv->SetParentEnv(thread, currentEnv.GetTaggedValue()); in RuntimeOptNewLexicalEnvWithName()
2929 JSTaggedValue scopeInfo = RuntimeOptGenerateScopeInfo(thread, scopeId, func.GetTaggedValue()); in RuntimeOptNewLexicalEnvWithName()
2930 newEnv->SetScopeInfo(thread, scopeInfo); in RuntimeOptNewLexicalEnvWithName()
2931 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptNewLexicalEnvWithName()
2936 JSTaggedValue RuntimeStubs::RuntimeOptCopyRestArgs(JSThread *thread, uint32_t actualArgc, uint32_t … in RuntimeOptCopyRestArgs() argument
2943 JSHandle<JSTaggedValue> restArray = JSArray::ArrayCreate(thread, JSTaggedNumber(actualRestNum)); in RuntimeOptCopyRestArgs()
2945 auto argv = GetActualArgv(thread); in RuntimeOptCopyRestArgs()
2947 JSMutableHandle<JSTaggedValue> element(thread, JSTaggedValue::Undefined()); in RuntimeOptCopyRestArgs()
2953 JSObject::SetProperty(thread, restArray, idx++, element, true); in RuntimeOptCopyRestArgs()
2955 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptCopyRestArgs()
2959 JSTaggedValue RuntimeStubs::RuntimeOptSuspendGenerator(JSThread *thread, const JSHandle<JSTaggedVal… in RuntimeOptSuspendGenerator() argument
2968 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptSuspendGenerator()
2975 generatorObjectHandle->SetTaskInfo(thread->GetTaskInfo()); in RuntimeOptSuspendGenerator()
2979 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptSuspendGenerator()
2982 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptSuspendGenerator()
2986 return RuntimeThrowTypeError(thread, "RuntimeSuspendGenerator failed"); in RuntimeOptSuspendGenerator()
2989 JSTaggedValue RuntimeStubs::RuntimeOptAsyncGeneratorResolve(JSThread *thread, JSHandle<JSTaggedValu… in RuntimeOptAsyncGeneratorResolve() argument
2992 [[maybe_unused]] EcmaHandleScope handleScope(thread); in RuntimeOptAsyncGeneratorResolve()
2996 …JSHandle<GeneratorContext> genContextHandle(thread, asyncGeneratorObjHandle->GetGeneratorContext(t… in RuntimeOptAsyncGeneratorResolve()
2999 …return JSAsyncGeneratorObject::AsyncGeneratorResolve(thread, asyncGeneratorObjHandle, valueHandle,… in RuntimeOptAsyncGeneratorResolve()
3002 JSTaggedValue RuntimeStubs::RuntimeOptConstruct(JSThread *thread, JSHandle<JSTaggedValue> ctor, in RuntimeOptConstruct() argument
3011 THROW_TYPE_ERROR_AND_RETURN(thread, "Constructor is false", JSTaggedValue::Exception()); in RuntimeOptConstruct()
3015 …return RuntimeOptConstructGeneric(thread, JSHandle<JSFunction>::Cast(ctor), newTarget, preArgs, ar… in RuntimeOptConstruct()
3019 thread, JSHandle<JSBoundFunction>::Cast(ctor), newTarget, preArgs, args); in RuntimeOptConstruct()
3022 … return RuntimeOptConstructProxy(thread, JSHandle<JSProxy>::Cast(ctor), newTarget, preArgs, args); in RuntimeOptConstruct()
3024 THROW_TYPE_ERROR_AND_RETURN(thread, "Constructor NonConstructor", JSTaggedValue::Exception()); in RuntimeOptConstruct()
3027 JSTaggedValue RuntimeStubs::RuntimeOptConstructProxy(JSThread *thread, JSHandle<JSProxy> ctor, in RuntimeOptConstructProxy() argument
3031 STACK_LIMIT_CHECK(thread, JSTaggedValue::Exception()); in RuntimeOptConstructProxy()
3033 JSHandle<JSTaggedValue> handler(thread, ctor->GetHandler(thread)); in RuntimeOptConstructProxy()
3035 … THROW_TYPE_ERROR_AND_RETURN(thread, "Constructor: handler is null", JSTaggedValue::Exception()); in RuntimeOptConstructProxy()
3038 JSHandle<JSTaggedValue> target(thread, ctor->GetTarget(thread)); in RuntimeOptConstructProxy()
3041 JSHandle<JSTaggedValue> key(thread->GlobalConstants()->GetHandledProxyConstructString()); in RuntimeOptConstructProxy()
3042 JSHandle<JSTaggedValue> method = JSObject::GetMethod(thread, handler, key); in RuntimeOptConstructProxy()
3045 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptConstructProxy()
3051 return RuntimeOptConstruct(thread, target, newTgt, preArgs, args); in RuntimeOptConstructProxy()
3058 JSHandle<TaggedArray> arr = thread->GetEcmaVM()->GetFactory()->NewTaggedArray(size); in RuntimeOptConstructProxy()
3062 JSTaggedValue value = tgaPreArgs->Get(thread, i); in RuntimeOptConstructProxy()
3063 arr->Set(thread, i, value); in RuntimeOptConstructProxy()
3068 JSTaggedValue value = args->Get(thread, i); in RuntimeOptConstructProxy()
3069 arr->Set(thread, i + preArgsSize, value); in RuntimeOptConstructProxy()
3071 JSHandle<JSArray> newArr = JSArray::CreateArrayFromList(thread, arr); in RuntimeOptConstructProxy()
3075 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeOptConstructProxy()
3076 …EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, method, handler, undefined… in RuntimeOptConstructProxy()
3077 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptConstructProxy()
3081 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptConstructProxy()
3084 THROW_TYPE_ERROR_AND_RETURN(thread, "new object is not object", JSTaggedValue::Exception()); in RuntimeOptConstructProxy()
3090 JSTaggedValue RuntimeStubs::RuntimeOptConstructBoundFunction(JSThread *thread, JSHandle<JSBoundFunc… in RuntimeOptConstructBoundFunction() argument
3095 JSHandle<JSTaggedValue> target(thread, ctor->GetBoundTarget(thread)); in RuntimeOptConstructBoundFunction()
3097 THROW_TYPE_ERROR_AND_RETURN(thread, "Constructor is false", JSTaggedValue::Exception()); in RuntimeOptConstructBoundFunction()
3100 JSHandle<TaggedArray> boundArgs(thread, ctor->GetBoundArguments(thread)); in RuntimeOptConstructBoundFunction()
3101 JSMutableHandle<JSTaggedValue> newPreArgs(thread, preArgs.GetTaggedValue()); in RuntimeOptConstructBoundFunction()
3106 … TaggedArray::Append(thread, boundArgs, JSHandle<TaggedArray>::Cast(preArgs)).GetTaggedValue()); in RuntimeOptConstructBoundFunction()
3108 JSMutableHandle<JSTaggedValue> newTargetMutable(thread, newTgt.GetTaggedValue()); in RuntimeOptConstructBoundFunction()
3109 if (JSTaggedValue::SameValue(thread, ctor.GetTaggedValue(), newTgt.GetTaggedValue())) { in RuntimeOptConstructBoundFunction()
3112 return RuntimeOptConstruct(thread, target, newTargetMutable, newPreArgs, args); in RuntimeOptConstructBoundFunction()
3115 JSTaggedValue RuntimeStubs::GetResultValue(JSThread *thread, bool isAotMethod, JSHandle<JSFunction>… in GetResultValue() argument
3120 uint32_t numArgs = ctor->GetCallTarget(thread)->GetNumArgsWithCallField(); in GetResultValue()
3122 const JSTaggedType *prevFp = thread->GetLastLeaveFrame(); in GetResultValue()
3131 resultValue = thread->GetEcmaVM()->FastCallAot(size, values.data(), prevFp); in GetResultValue()
3133 … resultValue = thread->GetEcmaVM()->ExecuteAot(size, values.data(), prevFp, needPushArgv); in GetResultValue()
3137 … EcmaInterpreter::NewRuntimeCallInfo(thread, JSHandle<JSTaggedValue>(ctor), obj, newTgt, size); in GetResultValue()
3138 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in GetResultValue()
3145 JSTaggedValue RuntimeStubs::RuntimeOptConstructGeneric(JSThread *thread, JSHandle<JSFunction> ctor, in RuntimeOptConstructGeneric() argument
3150 THROW_TYPE_ERROR_AND_RETURN(thread, "Constructor is false", JSTaggedValue::Exception()); in RuntimeOptConstructGeneric()
3153 JSHandle<JSTaggedValue> obj(thread, JSTaggedValue::Undefined()); in RuntimeOptConstructGeneric()
3154 if (ctor->IsBase(thread)) { in RuntimeOptConstructGeneric()
3155 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in RuntimeOptConstructGeneric()
3157 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptConstructGeneric()
3183 JSTaggedValue value = tgaPreArgs->Get(thread, i); in RuntimeOptConstructGeneric()
3187 values.emplace_back(args->Get(thread, i).GetRawData()); in RuntimeOptConstructGeneric()
3191 values.emplace_back(args->Get(thread, i).GetRawData()); in RuntimeOptConstructGeneric()
3194 …JSTaggedValue resultValue = RuntimeStubs::GetResultValue(thread, isCompiledCode, ctor, values, new… in RuntimeOptConstructGeneric()
3195 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptConstructGeneric()
3204 if (ctor->IsBase(thread)) { in RuntimeOptConstructGeneric()
3208 … THROW_TYPE_ERROR_AND_RETURN(thread, "function is non-constructor", JSTaggedValue::Exception()); in RuntimeOptConstructGeneric()
3213 JSTaggedValue RuntimeStubs::RuntimeOptNewObjRange(JSThread *thread, uintptr_t argv, uint32_t argc) in RuntimeOptNewObjRange() argument
3216 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in RuntimeOptNewObjRange()
3220 JSHandle<TaggedArray> args = thread->GetEcmaVM()->GetFactory()->NewTaggedArray(arrLength); in RuntimeOptNewObjRange()
3222 args->Set(thread, i, GetArg(argv, argc, i + firstArgOffset)); in RuntimeOptNewObjRange()
3224 JSTaggedValue object = RuntimeOptConstruct(thread, ctor, ctor, undefined, args); in RuntimeOptNewObjRange()
3225 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeOptNewObjRange()
3226 … (!object.IsUndefined() && !object.IsECMAObject() && !JSHandle<JSFunction>(ctor)->IsBase(thread)) { in RuntimeOptNewObjRange()
3227 THROW_TYPE_ERROR_AND_RETURN(thread, "Derived constructor must return object or undefined", in RuntimeOptNewObjRange()
3233 JSTaggedValue RuntimeStubs::RuntimeOptGenerateScopeInfo(JSThread *thread, uint16_t scopeId, JSTagge… in RuntimeOptGenerateScopeInfo() argument
3235 EcmaVM *ecmaVm = thread->GetEcmaVM(); in RuntimeOptGenerateScopeInfo()
3237 Method *method = ECMAObject::Cast(func.GetTaggedObject())->GetCallTarget(thread); in RuntimeOptGenerateScopeInfo()
3238 const JSPandaFile *jsPandaFile = method->GetJSPandaFile(thread); in RuntimeOptGenerateScopeInfo()
3239 JSHandle<ConstantPool> constpool(thread, method->GetConstantPool(thread)); in RuntimeOptGenerateScopeInfo()
3242 LiteralDataExtractor::GetDatasIgnoreType(thread, jsPandaFile, id, constpool); in RuntimeOptGenerateScopeInfo()
3253 JSTaggedValue val = elementsLiteral->Get(thread, i); in RuntimeOptGenerateScopeInfo()
3255 CString name = ConvertToString(thread, EcmaString::Cast(val.GetTaggedObject())); in RuntimeOptGenerateScopeInfo()
3256 int32_t slot = elementsLiteral->Get(thread, i + 1).GetInt(); in RuntimeOptGenerateScopeInfo()
3265 JSTaggedType *RuntimeStubs::GetActualArgv(JSThread *thread) in GetActualArgv() argument
3267 JSTaggedType *current = const_cast<JSTaggedType *>(thread->GetLastLeaveFrame()); in GetActualArgv()
3268 FrameIterator it(current, thread); in GetActualArgv()
3281 JSTaggedType *RuntimeStubs::GetActualArgvFromStub(JSThread *thread) in GetActualArgvFromStub() argument
3283 JSTaggedType *current = const_cast<JSTaggedType *>(thread->GetLastLeaveFrame()); in GetActualArgvFromStub()
3284 FrameIterator it(current, thread); in GetActualArgvFromStub()
3298 OptimizedJSFunctionFrame *RuntimeStubs::GetOptimizedJSFunctionFrame(JSThread *thread) in GetOptimizedJSFunctionFrame() argument
3300 JSTaggedType *current = const_cast<JSTaggedType *>(thread->GetLastLeaveFrame()); in GetOptimizedJSFunctionFrame()
3301 FrameIterator it(current, thread); in GetOptimizedJSFunctionFrame()
3308 OptimizedJSFunctionFrame *RuntimeStubs::GetOptimizedJSFunctionFrameNoGC(JSThread *thread) in GetOptimizedJSFunctionFrameNoGC() argument
3310 JSTaggedType *current = const_cast<JSTaggedType *>(thread->GetLastLeaveFrame()); in GetOptimizedJSFunctionFrameNoGC()
3311 FrameIterator it(current, thread); in GetOptimizedJSFunctionFrameNoGC()
3318 JSTaggedValue RuntimeStubs::RuntimeLdPatchVar(JSThread *thread, uint32_t index) in RuntimeLdPatchVar() argument
3321 JSHandle<TaggedArray>::Cast(thread->GetEcmaVM()->GetGlobalEnv()->GetGlobalPatch()); in RuntimeLdPatchVar()
3323 return globalPatch->Get(thread, index); in RuntimeLdPatchVar()
3326 JSTaggedValue RuntimeStubs::RuntimeStPatchVar(JSThread *thread, uint32_t index, const JSHandle<JSTa… in RuntimeStPatchVar() argument
3328 JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv(); in RuntimeStPatchVar()
3332 globalPatch = TaggedArray::SetCapacity(thread, globalPatch, index + 1); in RuntimeStPatchVar()
3334 globalPatch->Set(thread, index, value); in RuntimeStPatchVar()
3335 env->SetGlobalPatch(thread, globalPatch.GetTaggedValue()); in RuntimeStPatchVar()
3339 JSTaggedValue RuntimeStubs::RuntimeNotifyConcurrentResult(JSThread *thread, JSTaggedValue result, J… in RuntimeNotifyConcurrentResult() argument
3341 thread->GetEcmaVM()->TriggerConcurrentCallback(result, hint); in RuntimeNotifyConcurrentResult()
3345 JSTaggedValue RuntimeStubs::RuntimeUpdateAOTHClass(JSThread *thread, in RuntimeUpdateAOTHClass() argument
3349 JSHClass::ProcessAotHClassTransition(thread, oldhclass, newhclass, key); in RuntimeUpdateAOTHClass()
3354 JSTaggedValue RuntimeStubs::RuntimeDefineField(JSThread *thread, JSTaggedValue obj, in RuntimeDefineField() argument
3360 … THROW_TYPE_ERROR_AND_RETURN(thread, "DefineField: obj is not Object", JSTaggedValue::Exception()); in RuntimeDefineField()
3362 JSHandle<JSObject> handleObj(thread, obj); in RuntimeDefineField()
3363 JSHandle<JSTaggedValue> handleValue(thread, value); in RuntimeDefineField()
3364 …<JSTaggedValue> handleKey = JSTaggedValue::ToPropertyKey(thread, JSHandle<JSTaggedValue>(thread, p… in RuntimeDefineField()
3365 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeDefineField()
3367 … JSObject::CreateDataPropertyOrThrow(thread, handleObj, handleKey, handleValue, SCheckMode::CHECK); in RuntimeDefineField()
3368 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeDefineField()
3373 JSTaggedValue RuntimeStubs::RuntimeCreatePrivateProperty(JSThread *thread, JSTaggedValue lexicalEnv, in RuntimeCreatePrivateProperty() argument
3376 ObjectFactory* factory = thread->GetEcmaVM()->GetFactory(); in RuntimeCreatePrivateProperty()
3377 JSHandle<LexicalEnv> handleLexicalEnv(thread, lexicalEnv); in RuntimeCreatePrivateProperty()
3378 JSHandle<ConstantPool> handleConstpool(thread, constpool); in RuntimeCreatePrivateProperty()
3379 JSHandle<JSTaggedValue> handleModule(thread, module); in RuntimeCreatePrivateProperty()
3381 thread, thread->GetEcmaVM()->FindOrCreateUnsharedConstpool(constpool)); in RuntimeCreatePrivateProperty()
3382 CString entry = ModuleManager::GetRecordName(thread, handleModule.GetTaggedValue()); in RuntimeCreatePrivateProperty()
3385 while (startIndex < length && !handleLexicalEnv->GetProperties(thread, startIndex).IsHole()) { in RuntimeCreatePrivateProperty()
3389 JSTaggedValue aotSymbolInfo = unsharedConstpoolHandle->GetAotSymbolInfo(thread); in RuntimeCreatePrivateProperty()
3390 JSHandle<TaggedArray> aotSymbolInfoHandle(thread, aotSymbolInfo); in RuntimeCreatePrivateProperty()
3391 FrameHandler frameHandler(thread); in RuntimeCreatePrivateProperty()
3398 … JSTaggedValue symbol = ConstantPool::GetSymbolFromSymbolInfo(thread, aotSymbolInfoHandle, id); in RuntimeCreatePrivateProperty()
3400 symbolHandle = JSHandle<JSSymbol>(thread, symbol); in RuntimeCreatePrivateProperty()
3406 handleLexicalEnv->SetProperties(thread, index, symbolHandle.GetTaggedValue()); in RuntimeCreatePrivateProperty()
3410 ConstantPool::GetClassLiteralFromCache(thread, unsharedConstpoolHandle, literalId, entry); in RuntimeCreatePrivateProperty()
3411 JSHandle<ClassLiteral> classLiteral(thread, literalObj); in RuntimeCreatePrivateProperty()
3412 JSHandle<TaggedArray> literalBuffer(thread, classLiteral->GetArray(thread)); in RuntimeCreatePrivateProperty()
3418 …uint32_t instacePropertyCount = static_cast<uint32_t>(literalBuffer->Get(thread, literalBufferLeng… in RuntimeCreatePrivateProperty()
3421 JSMutableHandle<JSTaggedValue> literalValue(thread, JSTaggedValue::Undefined()); in RuntimeCreatePrivateProperty()
3423 literalValue.Update(literalBuffer->Get(thread, i)); in RuntimeCreatePrivateProperty()
3427 func->SetLexicalEnv(thread, handleLexicalEnv.GetTaggedValue()); in RuntimeCreatePrivateProperty()
3428 func->SetModule(thread, handleModule.GetTaggedValue()); in RuntimeCreatePrivateProperty()
3431 … handleLexicalEnv->SetProperties(thread, startIndex + count + i, literalValue.GetTaggedValue()); in RuntimeCreatePrivateProperty()
3437 … JSTaggedValue symbol = ConstantPool::GetSymbolFromSymbolInfo(thread, aotSymbolInfoHandle, id); in RuntimeCreatePrivateProperty()
3439 symbolHandle = JSHandle<JSSymbol>(thread, symbol); in RuntimeCreatePrivateProperty()
3445 handleLexicalEnv->SetProperties(thread, index, symbolHandle.GetTaggedValue()); in RuntimeCreatePrivateProperty()
3450 JSTaggedValue RuntimeStubs::RuntimeDefinePrivateProperty(JSThread *thread, JSTaggedValue lexicalEnv, in RuntimeDefinePrivateProperty() argument
3455 … currentLexicalEnv = LexicalEnv::Cast(currentLexicalEnv.GetTaggedObject())->GetParentEnv(thread); in RuntimeDefinePrivateProperty()
3458 …JSTaggedValue key = LexicalEnv::Cast(currentLexicalEnv.GetTaggedObject())->GetProperties(thread, s… in RuntimeDefinePrivateProperty()
3460 …JSHandle<JSTaggedValue> handleObj(thread, obj.IsJSProxy() ? JSProxy::Cast(obj)->GetPrivateField(th… in RuntimeDefinePrivateProperty()
3461 JSHandle<JSTaggedValue> handleKey(thread, key); in RuntimeDefinePrivateProperty()
3462 JSHandle<JSTaggedValue> handleValue(thread, value); in RuntimeDefinePrivateProperty()
3463 PropertyDescriptor desc(thread); in RuntimeDefinePrivateProperty()
3465 JSTaggedValue::GetOwnProperty(thread, handleObj, handleKey, desc)) { in RuntimeDefinePrivateProperty()
3466 …THROW_TYPE_ERROR_AND_RETURN(thread, "invalid private key or already exists", JSTaggedValue::Except… in RuntimeDefinePrivateProperty()
3468 bool extensible = handleObj->IsExtensible(thread); in RuntimeDefinePrivateProperty()
3470 …THROW_TYPE_ERROR_AND_RETURN(thread, "DefinePrivateProperty obj is undefined", JSTaggedValue::Excep… in RuntimeDefinePrivateProperty()
3473 THROW_TYPE_ERROR_AND_RETURN(thread, "shared obj cannot use # to define private property", in RuntimeDefinePrivateProperty()
3480 bool result = JSObject::CreateDataPropertyOrThrow(thread, JSHandle<JSObject>::Cast(handleObj), in RuntimeDefinePrivateProperty()
3482 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeDefinePrivateProperty()
3486 RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); in RuntimeDefinePrivateProperty()
3490 JSTaggedValue RuntimeStubs::RuntimeNotifyDebuggerStatement(JSThread *thread) in RuntimeNotifyDebuggerStatement() argument
3492 FrameHandler frameHandler(thread); in RuntimeNotifyDebuggerStatement()
3502 auto *debuggerMgr = thread->GetEcmaVM()->GetJsDebuggerManager(); in RuntimeNotifyDebuggerStatement()
3503 debuggerMgr->GetNotificationManager()->DebuggerStmtEvent(thread, method, bcOffset); in RuntimeNotifyDebuggerStatement()
3509 bool RuntimeStubs::CheckElementsNumber(const JSThread *thread, JSHandle<TaggedArray> elements, uint… in CheckElementsNumber() argument
3513 if (!elements->Get(thread, i).IsNumber()) { in CheckElementsNumber()
3520 JSHandle<JSTaggedValue> RuntimeStubs::GetOrCreateNumberString(JSThread *thread, JSHandle<JSTaggedVa… in GetOrCreateNumberString() argument
3523 JSMutableHandle<JSTaggedValue> presentString(thread, JSTaggedValue::Undefined()); in GetOrCreateNumberString()
3528 presentString.Update(JSTaggedValue::ToString(thread, presentValue).GetTaggedValue()); in GetOrCreateNumberString()
3534 JSTaggedValue RuntimeStubs::TryCopyCOWArray(JSThread *thread, JSHandle<JSArray> holderHandler, bool… in TryCopyCOWArray() argument
3537 JSArray::CheckAndCopyArray(thread, holderHandler); in TryCopyCOWArray()
3540 return holderHandler->GetElements(thread); in TryCopyCOWArray()
3543 JSTaggedValue RuntimeStubs::ArrayNumberSort(JSThread *thread, JSHandle<JSObject> thisObj, uint32_t … in ArrayNumberSort() argument
3545 JSMutableHandle<JSTaggedValue> presentValue(thread, JSTaggedValue::Undefined()); in ArrayNumberSort()
3546 JSMutableHandle<JSTaggedValue> middleValue(thread, JSTaggedValue::Undefined()); in ArrayNumberSort()
3547 JSMutableHandle<JSTaggedValue> previousValue(thread, JSTaggedValue::Undefined()); in ArrayNumberSort()
3548 bool isCOWArray = JSHandle<JSTaggedValue>(thisObj)->IsJSCOWArray(thread); in ArrayNumberSort()
3549 JSMutableHandle<TaggedArray> elements(thread, thisObj->GetElements(thread)); in ArrayNumberSort()
3554 presentValue.Update(elements->Get(thread, i)); in ArrayNumberSort()
3555 …JSHandle<JSTaggedValue> presentString = GetOrCreateNumberString(thread, presentValue, cachedString… in ArrayNumberSort()
3558 middleValue.Update(elements->Get(thread, middleIndex)); in ArrayNumberSort()
3559 … JSHandle<JSTaggedValue> middleString = GetOrCreateNumberString(thread, middleValue, cachedString); in ArrayNumberSort()
3560 … double compareResult = ArrayHelper::StringSortCompare(thread, middleString, presentString); in ArrayNumberSort()
3561 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception()); in ArrayNumberSort()
3570 previousValue.Update(elements->Get(thread, j - 1)); in ArrayNumberSort()
3571 elements.Update(TryCopyCOWArray(thread, JSHandle<JSArray>(thisObj), isCOWArray)); in ArrayNumberSort()
3572 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception()); in ArrayNumberSort()
3573 elements->Set(thread, j, previousValue); in ArrayNumberSort()
3575 elements.Update(TryCopyCOWArray(thread, JSHandle<JSArray>(thisObj), isCOWArray)); in ArrayNumberSort()
3576 RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception()); in ArrayNumberSort()
3577 elements->Set(thread, endIndex, presentValue); in ArrayNumberSort()
3585 auto thread = JSThread::GlueToJSThread(argGlue); in RuntimeTryGetInternString() local
3587 EcmaString *str = thread->GetEcmaVM()->GetEcmaStringTable()->TryGetInternString(thread, string); in RuntimeTryGetInternString()
3590 thread->GetEcmaVM()->GetEcmaStringTable()->TryGetInternString(thread, string); in RuntimeTryGetInternString()
3598 uint32_t RuntimeStubs::RuntimeGetBytecodePcOfstForBaseline(JSThread *thread, const JSHandle<JSFunct… in RuntimeGetBytecodePcOfstForBaseline() argument
3603 …const MachineCode *machineCode = MachineCode::Cast(func->GetBaselineCode(thread).GetTaggedObject()… in RuntimeGetBytecodePcOfstForBaseline()
3606 const Method *thisMethod = Method::Cast(func->GetMethod(thread).GetTaggedObject()); in RuntimeGetBytecodePcOfstForBaseline()
3608 const uint8_t *bytecodeEnd = bytecodeStart + thisMethod->GetCodeSize(thread); in RuntimeGetBytecodePcOfstForBaseline()
3638 uintptr_t RuntimeStubs::RuntimeGetNativePcOfstForBaseline(JSThread *thread, const JSHandle<JSFuncti… in RuntimeGetNativePcOfstForBaseline() argument
3646 const Method *thisMethod = Method::Cast(func->GetMethod(thread).GetTaggedObject()); in RuntimeGetNativePcOfstForBaseline()
3647 LOG_TRACE(INFO) << "deopt to baseline method name: " << thisMethod->GetMethodName(thread); in RuntimeGetNativePcOfstForBaseline()
3649 const uint8_t *bytecodeEnd = bytecodeStart + thisMethod->GetCodeSize(thread); in RuntimeGetNativePcOfstForBaseline()
3655 …const MachineCode *machineCode = MachineCode::Cast(func->GetBaselineCode(thread).GetTaggedObject()… in RuntimeGetNativePcOfstForBaseline()