!10221 Open no gc macro

Merge pull request !10221 from XinweiCai/open_no_gc
This commit is contained in:
openharmony_ci 2024-11-15 23:18:43 +00:00 committed by Gitee
commit 1cfd9f9cea
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
19 changed files with 57 additions and 260 deletions

View File

@ -153,7 +153,7 @@ JSTaggedValue BuiltinsArkTools::IsSlicedString(EcmaRuntimeCallInfo *info)
JSTaggedValue BuiltinsArkTools::IsStableJsArray(EcmaRuntimeCallInfo *info)
{
[[maybe_unused]] DisallowGarbageCollection noGc;
DISALLOW_GARBAGE_COLLECTION;
ASSERT(info);
JSThread *thread = info->GetThread();
RETURN_IF_DISALLOW_ARKTOOLS(thread);
@ -167,7 +167,7 @@ JSTaggedValue BuiltinsArkTools::IsStableJsArray(EcmaRuntimeCallInfo *info)
JSTaggedValue BuiltinsArkTools::IsNotHoleProperty(EcmaRuntimeCallInfo *info)
{
[[maybe_unused]] DisallowGarbageCollection noGc;
DISALLOW_GARBAGE_COLLECTION;
ASSERT(info);
JSThread *thread = info->GetThread();
RETURN_IF_DISALLOW_ARKTOOLS(thread);
@ -187,7 +187,7 @@ JSTaggedValue BuiltinsArkTools::IsNotHoleProperty(EcmaRuntimeCallInfo *info)
JSTaggedValue BuiltinsArkTools::HiddenStackSourceFile(EcmaRuntimeCallInfo *info)
{
[[maybe_unused]] DisallowGarbageCollection noGc;
DISALLOW_GARBAGE_COLLECTION;
ASSERT(info);
JSThread *thread = info->GetThread();
RETURN_IF_DISALLOW_ARKTOOLS(thread);

View File

@ -52,8 +52,6 @@ JSTaggedValue BuiltinsRegExp::RegExpConstructor(EcmaRuntimeCallInfo *argv)
} else {
auto ecmaVm = thread->GetEcmaVM();
JSHandle<GlobalEnv> env = ecmaVm->GetGlobalEnv();
// disable gc
[[maybe_unused]] DisallowGarbageCollection noGc;
// 4.a Let newTarget be the active function object.
newTarget = env->GetRegExpFunction();
JSHandle<JSTaggedValue> constructorString = globalConst->GetHandledConstructorString();
@ -94,8 +92,6 @@ JSTaggedValue BuiltinsRegExp::RegExpConstructor(EcmaRuntimeCallInfo *argv)
} else if (patternIsRegExp) {
JSHandle<JSTaggedValue> sourceString(globalConst->GetHandledSourceString());
JSHandle<JSTaggedValue> flagsString(globalConst->GetHandledFlagsString());
// disable gc
[[maybe_unused]] DisallowGarbageCollection noGc;
// 6.a Let P be Get(pattern, "source").
patternTemp = JSObject::GetProperty(thread, pattern, sourceString).GetValue();
// 6.b ReturnIfAbrupt(P).

View File

@ -1642,21 +1642,6 @@ DEF_CALL_SIGNATURE(ResumeRspAndRollback)
callSign->SetCallConv(CallSignature::CallConv::GHCCallConv);
}
DEF_CALL_SIGNATURE(StringsAreEquals)
{
// 2 : 2 input parameters
CallSignature stringsAreEquals("StringsAreEquals", 0, 2,
ArgumentsOrder::DEFAULT_ORDER, VariableType::BOOL());
*callSign = stringsAreEquals;
std::array<VariableType, 2> params = { // 2 : 2 input parameters
VariableType::JS_POINTER(),
VariableType::JS_POINTER(),
};
callSign->SetParameters(params.data());
callSign->SetGCLeafFunction(true);
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
}
DEF_CALL_SIGNATURE(JSHClassFindProtoTransitions)
{
// 3 : 3 input parameters
@ -2458,23 +2443,6 @@ DEF_CALL_SIGNATURE(CallDateNow)
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
}
DEF_CALL_SIGNATURE(FindElementWithCache)
{
// 4 : 4 input parameters
CallSignature index("FindElementWithCache", 0, 4, ArgumentsOrder::DEFAULT_ORDER, VariableType::INT32());
*callSign = index;
// 4 : 4 input parameters
std::array<VariableType, 4> params = {
VariableType::NATIVE_POINTER(),
VariableType::JS_ANY(),
VariableType::JS_ANY(),
VariableType::INT32(),
};
callSign->SetParameters(params.data());
callSign->SetGCLeafFunction(true);
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
}
DEF_CALL_SIGNATURE(UpdateFieldType)
{
// 2 : 2 input parameters
@ -2490,20 +2458,6 @@ DEF_CALL_SIGNATURE(UpdateFieldType)
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
}
DEF_CALL_SIGNATURE(NumberIsFinite)
{
// 1 : 1 input parameters
CallSignature index("NumberIsFinite", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::BOOL());
*callSign = index;
// 1 : 1 input parameters
std::array<VariableType, 1> params = {
VariableType::FLOAT64(),
};
callSign->SetParameters(params.data());
callSign->SetGCLeafFunction(true);
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
}
DEF_CALL_SIGNATURE(DoubleToInt)
{
// 2 : 2 input parameters
@ -2519,20 +2473,6 @@ DEF_CALL_SIGNATURE(DoubleToInt)
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
}
DEF_CALL_SIGNATURE(DoubleToLength)
{
// 1 : 1 input parameters
CallSignature index("DoubleToLength", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
*callSign = index;
// 1 : 1 input parameters
std::array<VariableType, 1> params = {
VariableType::FLOAT64(),
};
callSign->SetParameters(params.data());
callSign->SetGCLeafFunction(true);
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
}
DEF_CALL_SIGNATURE(MarkingBarrier)
{
// 4 : 4 input parameters
@ -2582,23 +2522,6 @@ DEF_CALL_SIGNATURE(SharedGCMarkingBarrier)
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
}
DEF_CALL_SIGNATURE(StoreBarrier)
{
// 4 : 4 input parameters
CallSignature index("StoreBarrier", 0, 4, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
*callSign = index;
// 4 : 4 input parameters
std::array<VariableType, 4> params = {
VariableType::NATIVE_POINTER(),
VariableType::JS_POINTER(),
VariableType::NATIVE_POINTER(),
VariableType::JS_POINTER()
};
callSign->SetParameters(params.data());
callSign->SetGCLeafFunction(true);
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
}
DEF_CALL_SIGNATURE(CallArg0)
{
// 2 : 2 input parameters
@ -2742,23 +2665,6 @@ DEF_CALL_SIGNATURE(JsBoundCallInternal)
callSign->SetCallConv(CallSignature::CallConv::CCallConv);
}
DEF_CALL_SIGNATURE(CreateArrayFromList)
{
// 3 : 3 input parameters
CallSignature createArrayFromList("CreateArrayFromList", 0, 3, ArgumentsOrder::DEFAULT_ORDER,
VariableType::JS_POINTER());
*callSign = createArrayFromList;
// 3 : 3 input parameters
std::array<VariableType, 3> params = {
VariableType::NATIVE_POINTER(),
VariableType::INT32(),
VariableType::NATIVE_POINTER(),
};
callSign->SetParameters(params.data());
callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_VARARGS);
}
DEF_CALL_SIGNATURE(DeoptHandlerAsm)
{
// 1 : 1 input parameters

View File

@ -486,7 +486,6 @@ private:
V(ResumeCaughtFrameAndDispatch) \
V(ResumeUncaughtFrameAndReturn) \
V(ResumeRspAndRollback) \
V(StringsAreEquals) \
V(BigIntEquals) \
V(BigIntSameValueZero) \
V(CallBigIntAsIntN) \
@ -508,7 +507,6 @@ private:
V(InsertLocalToShareRSet) \
V(SetBitAtomic) \
V(DoubleToInt) \
V(DoubleToLength) \
V(FloatMod) \
V(FloatAcos) \
V(FloatAcosh) \
@ -536,13 +534,10 @@ private:
V(FloatPow) \
V(FloatCeil) \
V(CallDateNow) \
V(NumberIsFinite) \
V(FindElementWithCache) \
V(UpdateFieldType) \
V(MarkingBarrier) \
V(MarkingBarrierWithEden) \
V(SharedGCMarkingBarrier) \
V(StoreBarrier) \
V(CallArg0) \
V(CallArg1) \
V(CallArgs2) \
@ -555,7 +550,6 @@ private:
V(JSFunctionEntry) \
V(OptimizedFastCallEntry) \
V(JSProxyCallInternalWithArgV) \
V(CreateArrayFromList) \
V(JSObjectGetMethod) \
V(JsProxyCallInternal) \
V(JsBoundCallInternal) \

View File

@ -578,7 +578,6 @@ void TypedBytecodeLowering::DeleteConstDataIfNoUser(GateRef gate)
void TypedBytecodeLowering::LowerTypedLdObjByName(GateRef gate)
{
DISALLOW_GARBAGE_COLLECTION;
LoadObjByNameTypeInfoAccessor tacc(compilationEnv_, circuit_, gate, chunk_);
if (TryLowerTypedLdobjBynameFromGloablBuiltin(gate)) {
@ -680,7 +679,6 @@ void TypedBytecodeLowering::LowerTypedLdObjByName(GateRef gate)
void TypedBytecodeLowering::LowerTypedLdPrivateProperty(GateRef gate)
{
DISALLOW_GARBAGE_COLLECTION;
LoadPrivatePropertyTypeInfoAccessor tacc(compilationEnv_, circuit_, gate, chunk_);
if (tacc.HasIllegalType()) {
@ -718,7 +716,6 @@ void TypedBytecodeLowering::LowerTypedLdPrivateProperty(GateRef gate)
void TypedBytecodeLowering::LowerTypedStPrivateProperty(GateRef gate)
{
DISALLOW_GARBAGE_COLLECTION;
StorePrivatePropertyTypeInfoAccessor tacc(compilationEnv_, circuit_, gate, chunk_);
if (tacc.HasIllegalType()) {
@ -757,7 +754,6 @@ void TypedBytecodeLowering::LowerTypedStPrivateProperty(GateRef gate)
void TypedBytecodeLowering::LowerTypedStObjByName(GateRef gate)
{
DISALLOW_GARBAGE_COLLECTION;
StoreObjByNameTypeInfoAccessor tacc(compilationEnv_, circuit_, gate, chunk_);
if (tacc.TypesIsEmpty() || tacc.HasIllegalType()) {
return;
@ -2294,7 +2290,6 @@ void TypedBytecodeLowering::LowerTypedTryLdGlobalByName(GateRef gate)
if (!enableLoweringBuiltin_) {
return;
}
DISALLOW_GARBAGE_COLLECTION;
LoadGlobalObjByNameTypeInfoAccessor tacc(compilationEnv_, circuit_, gate);
JSTaggedValue key = tacc.GetKeyTaggedValue();
if (key.IsUndefined()) {
@ -2382,7 +2377,6 @@ void TypedBytecodeLowering::LowerTypedStOwnByValue(GateRef gate)
void TypedBytecodeLowering::LowerCreateObjectWithBuffer(GateRef gate)
{
DISALLOW_GARBAGE_COLLECTION;
CreateObjWithBufferTypeInfoAccessor tacc(compilationEnv_, circuit_, gate, recordName_, chunk_);
if (!tacc.CanOptimize()) {
return;

View File

@ -87,7 +87,7 @@ JSTaggedValue JSMapIterator::NextInternal(JSThread *thread, JSHandle<JSTaggedVal
void JSMapIterator::Update(const JSThread *thread)
{
[[maybe_unused]] DisallowGarbageCollection noGc;
DISALLOW_GARBAGE_COLLECTION;
JSTaggedValue iteratedMap = GetIteratedMap();
if (iteratedMap.IsUndefined()) {
return;

View File

@ -393,9 +393,7 @@ bool JSObject::AddElementInternal(JSThread *thread, const JSHandle<JSObject> &re
}
}
if (receiver->IsJSSArray()) {
DISALLOW_GARBAGE_COLLECTION;
JSSharedArray *arr = JSSharedArray::Cast(*receiver);
uint32_t oldLength = arr->GetArrayLength();
uint32_t oldLength = JSSharedArray::Cast(*receiver)->GetArrayLength();
if (index >= oldLength) {
JSHandle<JSTaggedValue> newLength(thread, JSTaggedValue(static_cast<uint32_t>(index + 1)));
JSSharedArray::LengthSetter(thread, receiver, newLength);
@ -2878,7 +2876,7 @@ void JSObject::AddAccessor(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
bool JSObject::UpdatePropertyInDictionary(const JSThread *thread, JSTaggedValue key, JSTaggedValue value)
{
[[maybe_unused]] DisallowGarbageCollection noGc;
DISALLOW_GARBAGE_COLLECTION;
NameDictionary *dict = NameDictionary::Cast(GetProperties().GetTaggedObject());
int entry = dict->FindEntry(key);
if (entry == -1) {

View File

@ -79,7 +79,7 @@ JSTaggedValue JSSetIterator::NextInternal(JSThread *thread, JSHandle<JSTaggedVal
void JSSetIterator::Update(const JSThread *thread)
{
[[maybe_unused]] DisallowGarbageCollection noGc;
DISALLOW_GARBAGE_COLLECTION;
JSTaggedValue iteratedSet = GetIteratedSet();
if (iteratedSet.IsUndefined()) {
return;

View File

@ -81,30 +81,30 @@ bool JSTaggedValue::ToBoolean() const
JSTaggedNumber JSTaggedValue::ToNumber(JSThread *thread, JSTaggedValue tagged)
{
DISALLOW_GARBAGE_COLLECTION;
if (tagged.IsInt() || tagged.IsDouble()) {
return JSTaggedNumber(tagged);
}
switch (tagged.GetRawData()) {
case JSTaggedValue::VALUE_UNDEFINED:
case JSTaggedValue::VALUE_HOLE: {
return JSTaggedNumber(base::NAN_VALUE);
{
DISALLOW_GARBAGE_COLLECTION;
if (tagged.IsInt() || tagged.IsDouble()) {
return JSTaggedNumber(tagged);
}
case JSTaggedValue::VALUE_TRUE: {
return JSTaggedNumber(1);
switch (tagged.GetRawData()) {
case JSTaggedValue::VALUE_UNDEFINED:
case JSTaggedValue::VALUE_HOLE: {
return JSTaggedNumber(base::NAN_VALUE);
}
case JSTaggedValue::VALUE_TRUE: {
return JSTaggedNumber(1);
}
case JSTaggedValue::VALUE_FALSE:
case JSTaggedValue::VALUE_NULL: {
return JSTaggedNumber(0);
}
default: {
break;
}
}
case JSTaggedValue::VALUE_FALSE:
case JSTaggedValue::VALUE_NULL: {
return JSTaggedNumber(0);
if (tagged.IsString()) {
return StringToNumber(tagged);
}
default: {
break;
}
}
if (tagged.IsString()) {
return StringToNumber(tagged);
}
if (tagged.IsECMAObject()) {
JSHandle<JSTaggedValue>taggedHandle(thread, tagged);

View File

@ -690,7 +690,6 @@ JSTaggedValue JSTypedArray::FastGetPropertyByIndex(JSThread *thread, const JSTag
return JSTaggedValue::Undefined();
}
DISALLOW_GARBAGE_COLLECTION;
// Let length be the value of Os [[ArrayLength]] internal slot.
// If arrLen < 0 or index ≥ length, return undefined.
uint32_t arrLen = typedarrayObj->GetArrayLength();

View File

@ -217,7 +217,6 @@ template<bool checkDuplicateKeys /* = false*/>
void LayoutInfo::AddKey(const JSThread *thread, [[maybe_unused]] int index, const JSTaggedValue &key,
const PropertyAttributes &attr)
{
DISALLOW_GARBAGE_COLLECTION;
int number = NumberOfElements();
ASSERT(attr.GetOffset() == static_cast<uint32_t>(number));
ASSERT(number + 1 <= GetPropertiesCapacity());

View File

@ -119,10 +119,6 @@ using AllowLocalToShareWeakRefHandle = AssertScopeT<AssertType::LOCAL_TO_SHARE_W
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define CHECK_NO_GC ASSERT_PRINT(AllowGarbageCollection::IsAllowed(), "disallow execute garbage collection.")
// Some checks failed, need to check and fix
#undef CHECK_NO_GC
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define CHECK_NO_GC static_cast<void>(0)
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define CHECK_NO_HEAP_ALLOC ASSERT_PRINT(AllowHeapAlloc::IsAllowed(), "disallow execute heap alloc.")

View File

@ -1285,7 +1285,6 @@ void SourceTextModule::AddStarExportEntry(JSThread *thread, const JSHandle<Sourc
JSTaggedValue SourceTextModule::GetModuleValue(JSThread *thread, int32_t index, bool isThrow)
{
DISALLOW_GARBAGE_COLLECTION;
JSTaggedValue dictionary = GetNameDictionary();
if (dictionary.IsUndefined()) {
if (isThrow) {
@ -1300,7 +1299,6 @@ JSTaggedValue SourceTextModule::GetModuleValue(JSThread *thread, int32_t index,
JSTaggedValue SourceTextModule::GetModuleValue(JSThread *thread, JSTaggedValue key, bool isThrow)
{
DISALLOW_GARBAGE_COLLECTION;
JSTaggedValue dictionary = GetNameDictionary();
if (dictionary.IsUndefined()) {
if (isThrow) {

View File

@ -59,7 +59,7 @@ namespace panda::ecmascript {
std::pair<JSTaggedValue, bool> ObjectFastOperator::HasOwnProperty(JSThread *thread,
JSTaggedValue receiver, JSTaggedValue key)
{
[[maybe_unused]] DisallowGarbageCollection noGc;
DISALLOW_GARBAGE_COLLECTION;
if (!receiver.IsHeapObject() || !(receiver.IsRegularObject())) {
return std::make_pair(JSTaggedValue::Hole(), false);
}

View File

@ -412,7 +412,6 @@ SharedFieldType ObjectOperator::GetSharedFieldType() const
void ObjectOperator::ToPropertyDescriptor(PropertyDescriptor &desc) const
{
DISALLOW_GARBAGE_COLLECTION;
if (!IsFound()) {
return;
}

View File

@ -22,24 +22,23 @@ PatchErrorCode PatchLoader::LoadPatchInternal(JSThread *thread, const JSPandaFil
const JSPandaFile *patchFile, PatchInfo &patchInfo,
const CMap<uint32_t, CString> &baseClassInfo)
{
DISALLOW_GARBAGE_COLLECTION;
EcmaVM *vm = thread->GetEcmaVM();
// hot reload and hot patch only support merge-abc file.
if (baseFile->IsBundlePack() || patchFile->IsBundlePack()) {
LOG_ECMA(ERROR) << "base or patch is not merge abc!";
return PatchErrorCode::PACKAGE_NOT_ESMODULE;
{
DISALLOW_GARBAGE_COLLECTION;
// hot reload and hot patch only support merge-abc file.
if (baseFile->IsBundlePack() || patchFile->IsBundlePack()) {
LOG_ECMA(ERROR) << "base or patch is not merge abc!";
return PatchErrorCode::PACKAGE_NOT_ESMODULE;
}
// Generate patchInfo for hot reload, hot patch and cold patch.
patchInfo = PatchLoader::GeneratePatchInfo(patchFile);
if (!thread->GetCurrentEcmaContext()->HasCachedConstpool(baseFile)) {
LOG_ECMA(INFO) << "cold patch!";
vm->GetJsDebuggerManager()->GetHotReloadManager()->NotifyPatchLoaded(baseFile, patchFile);
return PatchErrorCode::SUCCESS;
}
}
// Generate patchInfo for hot reload, hot patch and cold patch.
patchInfo = PatchLoader::GeneratePatchInfo(patchFile);
if (!thread->GetCurrentEcmaContext()->HasCachedConstpool(baseFile)) {
LOG_ECMA(INFO) << "cold patch!";
vm->GetJsDebuggerManager()->GetHotReloadManager()->NotifyPatchLoaded(baseFile, patchFile);
return PatchErrorCode::SUCCESS;
}
[[maybe_unused]] EcmaHandleScope handleScope(thread);
// store base constpool in global object for avoid gc.

View File

@ -141,9 +141,7 @@ namespace panda::ecmascript {
V(MarkingBarrier) \
V(MarkingBarrierWithEden) \
V(SharedGCMarkingBarrier) \
V(StoreBarrier) \
V(DoubleToInt) \
V(DoubleToLength) \
V(FloatMod) \
V(FloatAcos) \
V(FloatAcosh) \
@ -170,11 +168,7 @@ namespace panda::ecmascript {
V(FloatPow) \
V(FloatCeil) \
V(CallDateNow) \
V(NumberIsFinite) \
V(FindElementWithCache) \
V(UpdateFieldType) \
V(CreateArrayFromList) \
V(StringsAreEquals) \
V(BigIntEquals) \
V(TimeClip) \
V(SetDateValues) \

View File

@ -657,6 +657,7 @@ DEF_RUNTIME_STUBS(RuntimeDump)
void RuntimeStubs::Dump(JSTaggedType rawValue)
{
DISALLOW_GARBAGE_COLLECTION;
std::ostringstream oss;
auto value = JSTaggedValue(rawValue);
value.Dump(oss);
@ -665,11 +666,13 @@ void RuntimeStubs::Dump(JSTaggedType rawValue)
void RuntimeStubs::DebugDump(JSTaggedType rawValue)
{
DISALLOW_GARBAGE_COLLECTION;
DebugDumpWithHint(reinterpret_cast<uintptr_t>(nullptr), rawValue);
}
void RuntimeStubs::DumpWithHint(uintptr_t hintStrAddress, JSTaggedType rawValue)
{
DISALLOW_GARBAGE_COLLECTION;
const char *origHintStr = reinterpret_cast<const char*>(hintStrAddress); // May be nullptr
const char *hintStr = (origHintStr == nullptr) ? "" : origHintStr;
DumpToStreamWithHint(std::cout, hintStr, JSTaggedValue(rawValue));
@ -678,6 +681,7 @@ void RuntimeStubs::DumpWithHint(uintptr_t hintStrAddress, JSTaggedType rawValue)
void RuntimeStubs::DebugDumpWithHint(uintptr_t hintStrAddress, JSTaggedType rawValue)
{
DISALLOW_GARBAGE_COLLECTION;
const char *origHintStr = reinterpret_cast<const char*>(hintStrAddress); // May be nullptr
const char *hintStr = (origHintStr == nullptr) ? "" : origHintStr;
// The immediate lambda expression call is not evaluated when the logger is unabled.
@ -3124,35 +3128,6 @@ DEF_RUNTIME_STUBS(DecodeURIComponent)
return result.GetRawData();
}
JSTaggedType RuntimeStubs::CreateArrayFromList([[maybe_unused]] uintptr_t argGlue, int32_t argc,
JSTaggedValue *argvPtr)
{
auto thread = JSThread::GlueToJSThread(argGlue);
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
JSHandle<TaggedArray> taggedArray = factory->NewTaggedArray(argc - NUM_MANDATORY_JSFUNC_ARGS);
for (int index = NUM_MANDATORY_JSFUNC_ARGS; index < argc; ++index) {
taggedArray->Set(thread, index - NUM_MANDATORY_JSFUNC_ARGS, argvPtr[index]);
}
JSHandle<JSArray> arrHandle = JSArray::CreateArrayFromList(thread, taggedArray);
return arrHandle.GetTaggedValue().GetRawData();
}
int32_t RuntimeStubs::FindElementWithCache(uintptr_t argGlue, JSTaggedType hclass,
JSTaggedType key, int32_t num)
{
auto thread = JSThread::GlueToJSThread(argGlue);
auto cls = reinterpret_cast<JSHClass *>(hclass);
JSTaggedValue propKey = JSTaggedValue(key);
auto layoutInfo = LayoutInfo::Cast(cls->GetLayout().GetTaggedObject());
PropertiesCache *cache = thread->GetPropertiesCache();
int index = cache->Get(cls, propKey);
if (index == PropertiesCache::NOT_FOUND) {
index = layoutInfo->BinarySearch(propKey, num);
cache->Set(cls, propKey, index);
}
return index;
}
void RuntimeStubs::UpdateFieldType(JSTaggedType hclass, uint64_t value)
{
auto cls = reinterpret_cast<JSHClass *>(hclass);
@ -3162,6 +3137,7 @@ void RuntimeStubs::UpdateFieldType(JSTaggedType hclass, uint64_t value)
JSTaggedType RuntimeStubs::GetActualArgvNoGC(uintptr_t argGlue)
{
DISALLOW_GARBAGE_COLLECTION;
auto thread = JSThread::GlueToJSThread(argGlue);
JSTaggedType *current = const_cast<JSTaggedType *>(thread->GetLastLeaveFrame());
FrameIterator it(current, thread);
@ -3302,11 +3278,6 @@ double RuntimeStubs::FloatPow(double base, double exp)
return std::pow(base, exp);
}
bool RuntimeStubs::NumberIsFinite(double x)
{
return std::isfinite(x);
}
double RuntimeStubs::CallDateNow()
{
// time from now is in ms.
@ -3323,18 +3294,6 @@ int32_t RuntimeStubs::DoubleToInt(double x, size_t bits)
return base::NumberHelper::DoubleToInt(x, bits);
}
JSTaggedType RuntimeStubs::DoubleToLength(double x)
{
double length = base::NumberHelper::TruncateDouble(x);
if (length < 0.0) {
return JSTaggedNumber(static_cast<double>(0)).GetRawData();
}
if (length > SAFE_NUMBER) {
return JSTaggedNumber(static_cast<double>(SAFE_NUMBER)).GetRawData();
}
return JSTaggedNumber(length).GetRawData();
}
void RuntimeStubs::InsertNewToEdenRSet([[maybe_unused]] uintptr_t argGlue,
uintptr_t object, size_t offset)
{
@ -3424,52 +3383,21 @@ void RuntimeStubs::SharedGCMarkingBarrier([[maybe_unused]] uintptr_t argGlue, Ta
Barriers::UpdateShared(thread, value, valueRegion);
}
void RuntimeStubs::StoreBarrier([[maybe_unused]] uintptr_t argGlue,
uintptr_t object, size_t offset, TaggedObject *value)
{
uintptr_t slotAddr = object + offset;
Region *objectRegion = Region::ObjectAddressToRange(object);
Region *valueRegion = Region::ObjectAddressToRange(value);
auto thread = JSThread::GlueToJSThread(argGlue);
#if ECMASCRIPT_ENABLE_BARRIER_CHECK
if (!thread->GetEcmaVM()->GetHeap()->IsAlive(JSTaggedValue(value).GetHeapObject())) {
LOG_FULL(FATAL) << "RuntimeStubs::StoreBarrier checked value:" << value << " is invalid!";
}
#endif
if (objectRegion->InGeneralOldSpace() && valueRegion->InGeneralNewSpace()) {
// Should align with '8' in 64 and 32 bit platform
ASSERT((slotAddr % static_cast<uint8_t>(MemAlignment::MEM_ALIGN_OBJECT)) == 0);
objectRegion->InsertOldToNewRSet(slotAddr);
} else if (!objectRegion->InSharedHeap() && valueRegion->InSharedSweepableSpace()) {
objectRegion->InsertLocalToShareRSet(slotAddr);
} else if (valueRegion->InEdenSpace() && objectRegion->InYoungSpace()) {
objectRegion->InsertNewToEdenRSet(slotAddr);
}
if (!valueRegion->InSharedHeap() && thread->IsConcurrentMarkingOrFinished()) {
Barriers::Update(thread, slotAddr, objectRegion, value, valueRegion);
}
if (valueRegion->InSharedSweepableSpace() && thread->IsSharedConcurrentMarkingOrFinished()) {
Barriers::UpdateShared(thread, value, valueRegion);
}
}
bool RuntimeStubs::StringsAreEquals(EcmaString *str1, EcmaString *str2)
{
return EcmaStringAccessor::StringsAreEqualDiffUtfEncoding(str1, str2);
}
bool RuntimeStubs::BigIntEquals(JSTaggedType left, JSTaggedType right)
{
DISALLOW_GARBAGE_COLLECTION;
return BigInt::Equal(JSTaggedValue(left), JSTaggedValue(right));
}
bool RuntimeStubs::BigIntSameValueZero(JSTaggedType left, JSTaggedType right)
{
DISALLOW_GARBAGE_COLLECTION;
return BigInt::SameValueZero(JSTaggedValue(left), JSTaggedValue(right));
}
JSTaggedValue RuntimeStubs::JSHClassFindProtoTransitions(JSHClass *cls, JSTaggedValue key, JSTaggedValue proto)
{
DISALLOW_GARBAGE_COLLECTION;
return JSTaggedValue(cls->FindProtoTransitions(key, proto));
}
@ -3487,17 +3415,20 @@ JSTaggedValue RuntimeStubs::NumberHelperStringToDouble(EcmaString *numberString)
JSTaggedValue RuntimeStubs::GetStringToListCacheArray(uintptr_t argGlue)
{
DISALLOW_GARBAGE_COLLECTION;
auto thread = JSThread::GlueToJSThread(argGlue);
return thread->GetCurrentEcmaContext()->GetStringToListResultCache().GetTaggedValue();
}
double RuntimeStubs::TimeClip(double time)
{
DISALLOW_GARBAGE_COLLECTION;
return JSDate::TimeClip(time);
}
double RuntimeStubs::SetDateValues(double year, double month, double day)
{
DISALLOW_GARBAGE_COLLECTION;
if (std::isnan(year) || !std::isfinite(year) || std::isnan(month) || !std::isfinite(month) || std::isnan(day) ||
!std::isfinite(day)) {
return base::NAN_VALUE;
@ -3712,6 +3643,7 @@ DEF_RUNTIME_STUBS(HClassCloneWithAddProto)
void RuntimeStubs::StartCallTimer(uintptr_t argGlue, JSTaggedType func, bool isAot)
{
DISALLOW_GARBAGE_COLLECTION;
auto thread = JSThread::GlueToJSThread(argGlue);
JSTaggedValue callTarget(func);
Method *method = Method::Cast(JSFunction::Cast(callTarget)->GetMethod());
@ -3726,6 +3658,7 @@ void RuntimeStubs::StartCallTimer(uintptr_t argGlue, JSTaggedType func, bool isA
void RuntimeStubs::EndCallTimer(uintptr_t argGlue, JSTaggedType func)
{
DISALLOW_GARBAGE_COLLECTION;
auto thread = JSThread::GlueToJSThread(argGlue);
JSTaggedValue callTarget(func);
Method *method = Method::Cast(JSFunction::Cast(callTarget)->GetMethod());

View File

@ -95,9 +95,6 @@ public:
static void MarkingBarrierWithEden([[maybe_unused]] uintptr_t argGlue,
uintptr_t object, size_t offset, TaggedObject *value);
static void SharedGCMarkingBarrier([[maybe_unused]] uintptr_t argGlue, TaggedObject *value);
static void StoreBarrier([[maybe_unused]] uintptr_t argGlue,
uintptr_t object, size_t offset, TaggedObject *value);
static JSTaggedType CreateArrayFromList([[maybe_unused]] uintptr_t argGlue, int32_t argc, JSTaggedValue *argvPtr);
static JSTaggedType GetActualArgvNoGC(uintptr_t argGlue);
static void InsertNewToEdenRSet([[maybe_unused]] uintptr_t argGlue, uintptr_t object, size_t offset);
static void InsertOldToNewRSet([[maybe_unused]] uintptr_t argGlue, uintptr_t object, size_t offset);
@ -105,7 +102,6 @@ public:
static void SetBitAtomic(GCBitset::GCBitsetWord *word, GCBitset::GCBitsetWord mask,
GCBitset::GCBitsetWord oldValue);
static int32_t DoubleToInt(double x, size_t bits);
static JSTaggedType DoubleToLength(double x);
static double FloatMod(double x, double y);
static double FloatAcos(double x);
static double FloatAcosh(double x);
@ -131,12 +127,8 @@ public:
static double FloatPow(double base, double exp);
static double FloatCbrt(double x);
static double FloatCeil(double x);
static bool NumberIsFinite(double x);
static double CallDateNow();
static int32_t FindElementWithCache(uintptr_t argGlue, JSTaggedType hclass,
JSTaggedType key, int32_t num);
static void UpdateFieldType(JSTaggedType hclass, uint64_t value);
static bool StringsAreEquals(EcmaString *str1, EcmaString *str2);
static bool BigIntEquals(JSTaggedType left, JSTaggedType right);
static bool BigIntSameValueZero(JSTaggedType key, JSTaggedType other);
static JSTaggedValue JSHClassFindProtoTransitions(JSHClass *cls, JSTaggedValue key, JSTaggedValue proto);