diff --git a/compiler_service/test/BUILD.gn b/compiler_service/test/BUILD.gn index 933eb0eae8ca4208b6bf9d8a1565894e712d7bd4..f457e8ad7fd3d4e61415608bab2a886310f3c423 100644 --- a/compiler_service/test/BUILD.gn +++ b/compiler_service/test/BUILD.gn @@ -14,20 +14,20 @@ group("compiler_service_unittest") { testonly = true deps = [ - #"unittest/aotcompilerargshandler_unit:AotCompilerArgsHandlerUnitTest", - #"unittest/aotcompilerclient_unit:AotCompilerClientUnitTest", - #"unittest/aotcompilererrorutils_unit:AotCompilerErrorUtilsUnitTest", - #"unittest/aotcompilerimpl_unit:AotCompilerImplUnitTest", - #"unittest/aotcompilerproxy_unit:AotCompilerProxyUnitTest", - #"unittest/aotcompilerservice_unit:AotCompilerServiceUnitTest", - #"unittest/aotcompilerstub_unit:AotCompilerStubUnitTest", + "unittest/aotcompilerargshandler_unit:AotCompilerArgsHandlerUnitTest", + "unittest/aotcompilerclient_unit:AotCompilerClientUnitTest", + "unittest/aotcompilererrorutils_unit:AotCompilerErrorUtilsUnitTest", + "unittest/aotcompilerimpl_unit:AotCompilerImplUnitTest", + "unittest/aotcompilerproxy_unit:AotCompilerProxyUnitTest", + "unittest/aotcompilerservice_unit:AotCompilerServiceUnitTest", + "unittest/aotcompilerstub_unit:AotCompilerStubUnitTest", ] } group("compiler_service_fuzztest") { testonly = true deps = [ - #"fuzztest/aotcompilerargsprepare_fuzzer:AotCompilerArgsPrepareFuzzTest", - #"fuzztest/compilerinterfacestub_fuzzer:CompilerInterfaceStubFuzzTest", + "fuzztest/aotcompilerargsprepare_fuzzer:AotCompilerArgsPrepareFuzzTest", + "fuzztest/compilerinterfacestub_fuzzer:CompilerInterfaceStubFuzzTest", ] } diff --git a/compiler_service/test/fuzztest/aotcompilerargsprepare_fuzzer/BUILD.gn b/compiler_service/test/fuzztest/aotcompilerargsprepare_fuzzer/BUILD.gn index 6270be63b00baa99fc57a19ac25c0227b39053bc..59e3407cf1718a1e2deafa95e3f72659675122d5 100644 --- a/compiler_service/test/fuzztest/aotcompilerargsprepare_fuzzer/BUILD.gn +++ b/compiler_service/test/fuzztest/aotcompilerargsprepare_fuzzer/BUILD.gn @@ -31,7 +31,6 @@ ohos_fuzztest("AotCompilerArgsPrepareFuzzTest") { ] configs = [ "$js_root:ark_jsruntime_public_config", - "$js_root:ark_jsruntime_common_config", ] version_script = "${compiler_service_root}/libaot_compiler_service.map" sources = [ diff --git a/compiler_service/test/fuzztest/compilerinterfacestub_fuzzer/BUILD.gn b/compiler_service/test/fuzztest/compilerinterfacestub_fuzzer/BUILD.gn index 9fe719bfbe140becadc147fed4c537971f435235..4f40c2415082cf9fdccfdbbd4ea75f5df20f61d2 100644 --- a/compiler_service/test/fuzztest/compilerinterfacestub_fuzzer/BUILD.gn +++ b/compiler_service/test/fuzztest/compilerinterfacestub_fuzzer/BUILD.gn @@ -31,7 +31,6 @@ ohos_fuzztest("CompilerInterfaceStubFuzzTest") { ] configs = [ "$js_root:ark_jsruntime_public_config", - "$js_root:ark_jsruntime_common_config", ] version_script = "${compiler_service_root}/libaot_compiler_service.map" sources = [ diff --git a/compiler_service/test/unittest/aotcompilerargshandler_unit/BUILD.gn b/compiler_service/test/unittest/aotcompilerargshandler_unit/BUILD.gn index 328a9661ac291c075cdb84f9e435aa36570a2cdf..1a8f27f92120f59cb5fed51448272ccade6827ec 100644 --- a/compiler_service/test/unittest/aotcompilerargshandler_unit/BUILD.gn +++ b/compiler_service/test/unittest/aotcompilerargshandler_unit/BUILD.gn @@ -28,7 +28,6 @@ ohos_unittest("AotCompilerArgsHandlerUnitTest") { configs = [ ":module_private_config", "$js_root:ark_jsruntime_public_config", - "$js_root:ark_jsruntime_common_config", ] version_script = "${compiler_service_root}/libaot_compiler_service.map" sources = [ diff --git a/compiler_service/test/unittest/aotcompilerclient_unit/BUILD.gn b/compiler_service/test/unittest/aotcompilerclient_unit/BUILD.gn index 3c928442cae3c25048aa370f0847eb8bda06ae7b..5299c50d77a85f38aca85d43d7db407c687d1000 100644 --- a/compiler_service/test/unittest/aotcompilerclient_unit/BUILD.gn +++ b/compiler_service/test/unittest/aotcompilerclient_unit/BUILD.gn @@ -29,7 +29,6 @@ ohos_unittest("AotCompilerClientUnitTest") { configs = [ ":module_private_config", "$js_root:ark_jsruntime_public_config", - "$js_root:ark_jsruntime_common_config", ] version_script = "${compiler_service_root}/libaot_compiler_service.map" sources = [ diff --git a/compiler_service/test/unittest/aotcompilererrorutils_unit/BUILD.gn b/compiler_service/test/unittest/aotcompilererrorutils_unit/BUILD.gn index 0dc8b62f619a4e0425870d1a5060804cf7a51f80..0648707e85660890a074c36e3b9be758bca7aafd 100644 --- a/compiler_service/test/unittest/aotcompilererrorutils_unit/BUILD.gn +++ b/compiler_service/test/unittest/aotcompilererrorutils_unit/BUILD.gn @@ -28,7 +28,6 @@ ohos_unittest("AotCompilerErrorUtilsUnitTest") { configs = [ ":module_private_config", "$js_root:ark_jsruntime_public_config", - "$js_root:ark_jsruntime_common_config", ] version_script = "${compiler_service_root}/libaot_compiler_service.map" sources = [ diff --git a/compiler_service/test/unittest/aotcompilerimpl_unit/BUILD.gn b/compiler_service/test/unittest/aotcompilerimpl_unit/BUILD.gn index 544ca595423ce88531917a7c891cf08fc60bde5f..5ac62e3f4164b24f9b4ee944d518ae859502b528 100644 --- a/compiler_service/test/unittest/aotcompilerimpl_unit/BUILD.gn +++ b/compiler_service/test/unittest/aotcompilerimpl_unit/BUILD.gn @@ -29,7 +29,6 @@ ohos_unittest("AotCompilerImplUnitTest") { configs = [ ":module_private_config", "$js_root:ark_jsruntime_public_config", - "$js_root:ark_jsruntime_common_config", ] version_script = "${compiler_service_root}/libaot_compiler_service.map" sources = [ diff --git a/compiler_service/test/unittest/aotcompilerproxy_unit/BUILD.gn b/compiler_service/test/unittest/aotcompilerproxy_unit/BUILD.gn index 7d92ac28acd95bbebf169cfbf1f86939a2e414f9..d530ab72999f48c90e687fb31b86bff25aa24783 100644 --- a/compiler_service/test/unittest/aotcompilerproxy_unit/BUILD.gn +++ b/compiler_service/test/unittest/aotcompilerproxy_unit/BUILD.gn @@ -28,7 +28,6 @@ ohos_unittest("AotCompilerProxyUnitTest") { configs = [ ":module_private_config", "$js_root:ark_jsruntime_public_config", - "$js_root:ark_jsruntime_common_config", ] version_script = "${compiler_service_root}/libaot_compiler_service.map" sources = [ diff --git a/compiler_service/test/unittest/aotcompilerservice_unit/BUILD.gn b/compiler_service/test/unittest/aotcompilerservice_unit/BUILD.gn index c8517a6fe2768940b6dcf20f136e25b6b4ec5d23..9db3234f84b32e7202f67aa23c6a4cdb21c8adbf 100644 --- a/compiler_service/test/unittest/aotcompilerservice_unit/BUILD.gn +++ b/compiler_service/test/unittest/aotcompilerservice_unit/BUILD.gn @@ -29,7 +29,6 @@ ohos_unittest("AotCompilerServiceUnitTest") { configs = [ ":module_private_config", "$js_root:ark_jsruntime_public_config", - "$js_root:ark_jsruntime_common_config", ] version_script = "${compiler_service_root}/libaot_compiler_service.map" sources = [ diff --git a/compiler_service/test/unittest/aotcompilerstub_unit/BUILD.gn b/compiler_service/test/unittest/aotcompilerstub_unit/BUILD.gn index c451bf646afa1fbf00f29d7209fd2a20ad3bf502..a417cf0a9755c3a438949d4767f435a5d703b871 100644 --- a/compiler_service/test/unittest/aotcompilerstub_unit/BUILD.gn +++ b/compiler_service/test/unittest/aotcompilerstub_unit/BUILD.gn @@ -28,7 +28,6 @@ ohos_unittest("AotCompilerStubUnitTest") { configs = [ ":module_private_config", "$js_root:ark_jsruntime_public_config", - "$js_root:ark_jsruntime_common_config", ] version_script = "${compiler_service_root}/libaot_compiler_service.map" sources = [ diff --git a/ecmascript/builtins/builtins_arraybuffer.cpp b/ecmascript/builtins/builtins_arraybuffer.cpp index 44ca29e3d4b3ba83e8b458bf64dc285303dd7da0..a4bf0f7a5257c61d0ef245dabdd72a27f3debb26 100644 --- a/ecmascript/builtins/builtins_arraybuffer.cpp +++ b/ecmascript/builtins/builtins_arraybuffer.cpp @@ -229,10 +229,6 @@ JSTaggedValue BuiltinsArrayBuffer::AllocateArrayBuffer(JSThread *thread, const J if (byteLength > INT_MAX) { THROW_RANGE_ERROR_AND_RETURN(thread, "Out of range", JSTaggedValue::Exception()); } - uint64_t totalNativeSize = static_cast(thread->GetNativeAreaAllocator()->GetArrayBufferNativeSize()); - if (UNLIKELY(totalNativeSize > MAX_NATIVE_SIZE_LIMIT)) { - THROW_RANGE_ERROR_AND_RETURN(thread, NATIVE_SIZE_OUT_OF_LIMIT_MESSAGE, JSTaggedValue::Exception()); - } uint32_t arrayByteLength = static_cast(byteLength); JSHandle arrayBuffer(obj); // 6. Set obj’s [[ArrayBufferData]] internal slot to block. diff --git a/ecmascript/builtins/builtins_arraybuffer.h b/ecmascript/builtins/builtins_arraybuffer.h index 1a0f5ff025e6a995e0e7373728522e37080ff1ae..2fdc5d43697e5b82f4fe22dac45727e07fef8b0c 100644 --- a/ecmascript/builtins/builtins_arraybuffer.h +++ b/ecmascript/builtins/builtins_arraybuffer.h @@ -113,10 +113,6 @@ public: DataViewType type, bool littleEndian); static void *GetDataPointFromBuffer(JSTaggedValue arrBuf, uint32_t byteOffset = 0); -protected: - static constexpr uint64_t MAX_NATIVE_SIZE_LIMIT = 4_GB; - static constexpr char const *NATIVE_SIZE_OUT_OF_LIMIT_MESSAGE = "total array buffer size out of limit(4_GB)"; - private: #define BUILTIN_ARRAY_BUFFER_ENTRY(name, func, length, id) \ base::BuiltinFunctionEntry::Create((name), (BuiltinsArrayBuffer::func), (length), (BUILTINS_STUB_ID(id))), diff --git a/ecmascript/napi/jsnapi_expo.cpp b/ecmascript/napi/jsnapi_expo.cpp index c8c80d7c0ddb7abb7de9b0edf9dadd7e2fc3b792..07fb029a7a1987eecc58111ff6c51868d57858f0 100644 --- a/ecmascript/napi/jsnapi_expo.cpp +++ b/ecmascript/napi/jsnapi_expo.cpp @@ -2383,6 +2383,10 @@ Local StringRef::EncodeIntoUint8Array(const EcmaVM *vm) JSHandle obj = TypedArrayHelper::FastCreateTypedArray(thread, thread->GlobalConstants()->GetHandledUint8ArrayString(), length - 1, DataViewType::UINT8); + if (JSNApi::HasPendingException(vm)) { + LOG_ECMA(ERROR) << "JSNapi EncodeIntoUint8Array: Create TypedArray failed"; + return Undefined(vm); + } JSHandle arrayBuffer(thread, JSTypedArray::Cast(*obj)->GetViewedArrayBufferOrByteArray()); JSTaggedValue bufferData = JSHandle::Cast(arrayBuffer)->GetArrayBufferData(); void *buffer = JSNativePointer::Cast(bufferData.GetTaggedObject())->GetExternalPointer(); diff --git a/test/moduletest/allocatearraybuffer/allocatearraybuffer.js b/test/moduletest/allocatearraybuffer/allocatearraybuffer.js index 9475338d24f294f0852b924207effe4c936f1a77..0e5a07d549ce9fda4da7b6abe50b040f9b620123 100644 --- a/test/moduletest/allocatearraybuffer/allocatearraybuffer.js +++ b/test/moduletest/allocatearraybuffer/allocatearraybuffer.js @@ -40,23 +40,6 @@ for (let i = 0; i < v32.length; i++) { const v36 = this.Atomics; print(v36.and(v32, this, v36)); -function f() { - let a1 = new ArrayBuffer(1025*1025*1025); - let a2 = new ArrayBuffer(1025*1025*1025); - let a3 = new ArrayBuffer(1025*1025*1025); - let a4 = new ArrayBuffer(1025*1025*1025); - try { - let arr = new ArrayBuffer(10); - print(a1.byteLength + a2.byteLength + a3.byteLength + a4.byteLength + arr.byteLength); - } catch (error) { - print(error); - } -} -f(); -ArkTools.forceFullGC(); -f(); -ArkTools.forceFullGC(); - function SendableArrayBufferTest() { try { const o1 = {}; diff --git a/test/moduletest/allocatearraybuffer/expect_output.txt b/test/moduletest/allocatearraybuffer/expect_output.txt index 6b6c6971a7e0e21c984f342e5f787df86f4c9cf6..5fd9e962a359b02511ec76f82633c98d8d966fb4 100644 --- a/test/moduletest/allocatearraybuffer/expect_output.txt +++ b/test/moduletest/allocatearraybuffer/expect_output.txt @@ -14,6 +14,4 @@ undefined NaN 1 -RangeError: total array buffer size out of limit(4_GB) -RangeError: total array buffer size out of limit(4_GB) TypeError: shared ctor cannot assign unshared newTarget \ No newline at end of file