mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-30 21:51:21 +00:00
Modify use cases to run on WGR development board
description:Modify use cases to run on WGR development board issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5QD96 Signed-off-by: jing_han <hanjing35@huawei.com>
This commit is contained in:
parent
bc5f967b66
commit
1fccbb976f
@ -28,6 +28,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
Deleter deleter = nullptr;
|
||||
ArrayBufferRef::New(vm, (void*)data, (int32_t)size, deleter, (void*)data);
|
||||
JSNApi::DestroyJSVM(vm);
|
||||
|
@ -31,7 +31,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -31,7 +31,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ namespace OHOS {
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int64_t input = 0;
|
||||
size_t maxByteLen = 8;
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > maxByteLen) {
|
||||
size = maxByteLen;
|
||||
}
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
uint64_t input = 0;
|
||||
size_t maxByteLen = 8;
|
||||
if (size > maxByteLen) {
|
||||
|
@ -30,7 +30,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
auto vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
bool input = true;
|
||||
if (size == 0 || data == nullptr) {
|
||||
input = false;
|
||||
|
@ -31,7 +31,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
auto vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
double input = 0;
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
auto vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
std::string message(data, data+size);
|
||||
OnMessage(vm, std::move(message));
|
||||
JSNApi::DestroyJSVM(vm);
|
||||
|
@ -31,6 +31,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
int input = 0;
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
|
@ -32,6 +32,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int input = 0;
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -28,6 +28,9 @@ namespace OHOS {
|
||||
option.SetGcType(RuntimeOption::GC_TYPE::GEN_GC);
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
auto vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
Local<StringRef> entry = StringRef::NewFromUtf8(vm, PANDA_MAIN_FUNCTION);
|
||||
std::string a = entry->StringRef::ToString();
|
||||
JSNApi::Execute(vm, data, size, a);
|
||||
|
@ -32,7 +32,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -31,7 +31,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -32,6 +32,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
FunctionCallback nativeFunc = FuncRefCallCallbackForTest;
|
||||
Deleter deleter = nullptr;
|
||||
Local<FunctionRef> func = FunctionRef::New(vm, nativeFunc, deleter, (void *)(data + size));
|
||||
|
@ -33,6 +33,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
FunctionCallback nativeFunc = FuncRefConCallbackForTest;
|
||||
Deleter deleter = nullptr;
|
||||
Local<FunctionRef> func = FunctionRef::New(vm, nativeFunc, deleter, (void *)(data + size));
|
||||
|
@ -32,6 +32,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
FunctionCallback nativeFunc = FuncRefNewCallbackForTest;
|
||||
Deleter deleter = nullptr;
|
||||
FunctionRef::New(vm, nativeFunc, deleter, (void *)(data + size));
|
||||
|
@ -32,6 +32,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
FunctionCallback nativeFunc = FuncRefNewCFCallbackForTest;
|
||||
Deleter deleter = nullptr;
|
||||
FunctionRef::NewClassFunction(vm, nativeFunc, deleter, (void *)(data + size));
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
int32_t index = 0;
|
||||
size_t maxByteLen = 4;
|
||||
if (size > maxByteLen) {
|
||||
|
@ -22,11 +22,14 @@ using namespace panda;
|
||||
using namespace panda::ecmascript;
|
||||
|
||||
namespace OHOS {
|
||||
bool GetWordsArrayFuzzTest(const uint8_t* data, size_t size)
|
||||
void GetWordsArrayFuzzTest(const uint8_t* data, size_t size)
|
||||
{
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
bool sign = true;
|
||||
const size_t uint64BytesNum = 8;
|
||||
if (size < uint64BytesNum) {
|
||||
@ -40,7 +43,7 @@ namespace OHOS {
|
||||
Local<BigIntRef> bigWords(bigWordsValue);
|
||||
bigWords->GetWordsArray(&sign, 1U, wordsArray);
|
||||
JSNApi::DestroyJSVM(vm);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
size_t wordsNum = size / uint64BytesNum;
|
||||
@ -69,7 +72,7 @@ namespace OHOS {
|
||||
Local<BigIntRef> bigWords(bigWordsValue);
|
||||
bigWords->GetWordsArray(&sign, wordsNum, wordsArray);
|
||||
JSNApi::DestroyJSVM(vm);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -31,7 +31,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -31,7 +31,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
JSNApi::SetHostPromiseRejectionTracker(vm, (void *)(data + size), (void *)data);
|
||||
JSNApi::DestroyJSVM(vm);
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
std::string dirPath(data, data + size);
|
||||
std::string requestPath(data, data + size);
|
||||
using CallbackType = std::function<std::string(std::string, std::string)>;
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
int32_t instanceId = 0;
|
||||
const int32_t int32ByteLen = 4;
|
||||
if (size > int32ByteLen) {
|
||||
|
@ -26,6 +26,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
NativePointerRef::New(vm, (void *)(data + size));
|
||||
JSNApi::DestroyJSVM(vm);
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
NativePointerCallback callBack = nullptr;
|
||||
NativePointerRef::New(vm, (void *)(data + size), callBack, (void*)data);
|
||||
JSNApi::DestroyJSVM(vm);
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
int64_t input = 0;
|
||||
size_t maxByteLen = 8;
|
||||
if (size > maxByteLen) {
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
uint64_t input = 0;
|
||||
size_t maxByteLen = 8;
|
||||
if (size > maxByteLen) {
|
||||
|
@ -30,6 +30,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
auto vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
double input = 0;
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
|
@ -29,6 +29,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
auto vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
int32_t input = 0;
|
||||
if (size > INT32_BETY_SIZE) {
|
||||
size = INT32_BETY_SIZE;
|
||||
|
@ -29,6 +29,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
auto vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
int64_t input = 0;
|
||||
if (size > INT64_BETY_SIZE) {
|
||||
size = INT64_BETY_SIZE;
|
||||
|
@ -30,6 +30,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
auto vm = JSNApi::CreateJSVM(option);
|
||||
uint32_t input = 0;
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > UINT32_BETY_SIZE) {
|
||||
size = UINT32_BETY_SIZE;
|
||||
}
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
uint32_t key = 0;
|
||||
size_t maxByteLen = 4;
|
||||
if (size > maxByteLen) {
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
int32_t key = 0;
|
||||
size_t maxByteLen = 4;
|
||||
if (size > maxByteLen) {
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
uint32_t key = 0;
|
||||
size_t maxByteLen = 4;
|
||||
if (size > maxByteLen) {
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
uint32_t key = 0;
|
||||
size_t maxByteLen = 4;
|
||||
if (size > maxByteLen) {
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
int32_t index = 0;
|
||||
size_t maxByteLen = 4;
|
||||
if (size > maxByteLen) {
|
||||
|
@ -27,6 +27,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
std::string fileName(data, data + size);
|
||||
#ifndef ECMASCRIPT_SUPPORT_CPUPROFILER
|
||||
#define ECMASCRIPT_SUPPORT_CPUPROFILER
|
||||
|
@ -29,6 +29,9 @@ namespace OHOS {
|
||||
RuntimeOption option;
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
std::string path(data, data + size);
|
||||
DFXJSNApi::StopHeapTracking(vm, path);
|
||||
JSNApi::DestroyJSVM(vm);
|
||||
|
@ -30,7 +30,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -31,7 +31,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -31,7 +31,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
@ -31,7 +31,9 @@ namespace OHOS {
|
||||
option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR);
|
||||
EcmaVM *vm = JSNApi::CreateJSVM(option);
|
||||
int32_t input;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
if (size > MAXBYTELEN) {
|
||||
size = MAXBYTELEN;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user