JavaScriptCore

RSS for tag

Evaluate JavaScript programs from within an app and support JavaScript scripting of your app using JavaScriptCore.

JavaScriptCore Documentation

Posts under JavaScriptCore tag

8 Posts
Sort by:
Post not yet marked as solved
4 Replies
323 Views
Years ago, JSCore on non-macOS disabled JIT, leading to much worse performance than could possibly be achieved with JIT on. Has anything changed recently to permit greater optimizations for JSCore on mobile platforms? (iPadOS, visionOS). My guess is ”no” since the docs still llist only macOS under the MAP_JIT flag, but as far as I know, Apple could still choose to enable JSCore optimizations behind the scenes if this option were available to developers.
Posted Last updated
.
Post not yet marked as solved
0 Replies
244 Views
Hi I use JSObjectMakeTypedArrayWithBytesNoCopy(JSContextRef ctx, JSTypedArrayType arrayType, void *bytes, size_t byteLength, JSTypedArrayBytesDeallocator bytesDeallocator, void *deallocatorContext, JSValueRef *exception) to create a JSObjectRef, and [JSValue valueWithJSValueRef: inContext:] to create a JSValue. I then pass the JSValue to the JSContext. I have noticed that even if I don't pass the JSValue to the JSContext, the JSTypedArrayBytesDeallocator is always called after the deallocation of the JSContext. In my understanding, it should be released by the JS garbage collection when there are no references to it. Since I have a large amount of data to pass to the JSContext, if the JSTypedArrayBytesDeallocator is called too late, it may cause memory issues. Where am I mistaken in this case? Thanks.
Posted
by HenryL.
Last updated
.
Post not yet marked as solved
0 Replies
457 Views
Javascript is being executed while using UI and WK WebView. However, since iOS 17.0.3, the WTFCrashWithInfoImpl issue has been posted in CrashReport, and it has been determined that Javascript is not supported in WebView for certain users. I wonder if there has been a fix in JavascriptCore.
Posted
by kodaewon.
Last updated
.
Post marked as solved
11 Replies
3.4k Views
After iOS15.4 was released, we noticed the issue. It seems a system bug. It's waiting for the lock for a long time(dead lock). Hardware Model: iPhone13,3 Process: app [9492] Path: /private/var/containers/Bundle/Application/***/app.app/app Identifier: com.aaa.app AppStoreTools: 13C90b AppVariant: 1:iPhone13,3:15 Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Coalition: com.aaa.app [956] Date/Time: 2022-03-17 18:04:46.2811 +0800 Launch Time: 2022-03-17 17:35:18.7389 +0800 OS Version: iPhone OS 15.4 (19E241) Release Type: User Baseband Version: 2.53.01 Report Version: 104 Exception Type: EXC_CRASH (SIGKILL) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: FRONTBOARD 2343432205 <RBSTerminateContext| domain:10 code:0x8BADF00D explanation:scene-update watchdog transgression: application<com.aaa.app>:9492 exhausted real (wall clock) time allowance of 10.00 seconds ProcessVisibility: Background ProcessState: Running WatchdogEvent: scene-update WatchdogVisibility: Background WatchdogCPUStatistics: ( "Elapsed total CPU time (seconds): 20.970 (user 13.070, system 7.900), 35% CPU", "Elapsed application CPU time (seconds): 0.829, 1% CPU" ) reportType:CrashLog maxTerminationResistance:Interactive> Triggered by Thread: 0 Kernel Triage: VM - pmap_enter failed with resource shortage VM - pmap_enter failed with resource shortage Thread 0 name: Thread 0 Crashed: 0 libsystem_kernel.dylib 0x00000001cddd1178 __ulock_wait + 8 1 libsystem_platform.dylib 0x0000000207a399ac _os_unfair_lock_lock_slow + 172 (lock.c:578) 2 JavaScriptCore 0x00000001a26f1c38 pas_page_sharing_pool_take_least_recently_used + 800 (lock_private.h:684) 3 JavaScriptCore 0x00000001a26f2cf4 pas_physical_page_sharing_pool_take + 248 (pas_page_sharing_pool.c:716) 4 JavaScriptCore 0x00000001a26ca2ec bmalloc_medium_bitfit_page_config_specialized_allocator_try_allocate + 260 (pas_page_sharing_pool.c:862) 5 JavaScriptCore 0x00000001a26cf48c bmalloc_heap_config_specialized_local_allocator_try_allocate_slow + 328 (pas_local_allocator_inlines.h:1595) 6 JavaScriptCore 0x00000001a26ba39c bmalloc_allocate_impl_casual_case + 888 (pas_local_allocator_inlines.h:1796) 7 JavaScriptCore 0x00000001a19d6fb8 ***::RobinHoodHashTable<***::RefPtr<***::UniquedStringImpl, ***::RawPtrTraits<***::UniquedStringImpl>, ***::DefaultRefDerefTraits<***::UniquedStringImpl> >, ***::KeyValuePair<***::RefPtr<***::Uniqu... + 52 (FastMalloc.h:219) 8 JavaScriptCore 0x00000001a19c6a2c ***::HashTableAddResult<***::HashTableIterator<***::RobinHoodHashTable<***::RefPtr<***::UniquedStringImpl, ***::RawPtrTraits<***::UniquedStringImpl>, ***::DefaultRefDerefTraits<***::UniquedStringIm... + 140 (RobinHoodHashTable.h:729) 9 JavaScriptCore 0x00000001a19c3dac JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry(JSC::VM&) + 33204 (BytecodeIntrinsicRegistry.cpp:59) 10 JavaScriptCore 0x00000001a23931fc JSC::VM::VM(JSC::VM::VMType, JSC::HeapType, ***::RunLoop*, bool*) + 11444 (unique_ptr.h:728) 11 JavaScriptCore 0x00000001a2395fd8 JSC::VM::createContextGroup(JSC::HeapType) + 52 (VM.cpp:241) 12 JavaScriptCore 0x00000001a1811dc0 JSContextGroupCreate + 32 (JSContextRef.cpp:70) 13 JavaScriptCore 0x00000001a14aa2a4 -[JSVirtualMachine init] + 24 (JSVirtualMachine.mm:94) 14 JavaScriptCore 0x00000001a14aa304 -[JSContext init] + 32 (JSContext.mm:71) 15 WebKit 0x00000001a5058b94 API::SharedJSContext::ensureContext() + 56 (APISerializedScriptValueCocoa.mm:51) 16 WebKit 0x00000001a5058ad4 API::SerializedScriptValue::deserialize(WebCore::SerializedScriptValue&, OpaqueJSValue const**) + 44 (APISerializedScriptValueCocoa.mm:78) 17 WebKit 0x00000001a50d7180 ScriptMessageHandlerDelegate::didPostMessage(WebKit::WebPageProxy&, WebKit::FrameInfoData&&, API::ContentWorld&, WebCore::SerializedScriptValue&) + 136 (WKUserContentController.mm:152) 18 WebKit 0x00000001a5424da4 WebKit::WebUserContentControllerProxy::didPostMessage(***::ObjectIdentifier<WebKit::WebPageProxyIdentifierType>, WebKit::FrameInfoData&&, unsigned long long, ***::Span<unsigned char const, 18446744... + 732 (WebUserContentControllerProxy.cpp:346) 19 WebKit 0x00000001a5708dcc WebKit::WebUserContentControllerProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) + 2716 (HandleMessage.h:139) 20 WebKit 0x00000001a5159b60 IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&) + 264 (MessageReceiverMap.cpp:129) 21 WebKit 0x00000001a5381dac WebKit::WebProcessProxy::didReceiveMessage(IPC::Connection&, IPC::Decoder&) + 40 (AuxiliaryProcessProxy.cpp:247) 22 WebKit 0x00000001a514e2ac IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >) + 788 (Connection.cpp:1080) 23 WebKit 0x00000001a514d960 IPC::Connection::dispatchIncomingMessages() + 508 (Connection.cpp:1229) 24 JavaScriptCore 0x00000001a265de10 ***::RunLoop::performWork() + 200 (Function.h:82) 25 JavaScriptCore 0x00000001a265ebac ***::RunLoop::performWork(void*) + 36 (RunLoopCF.cpp:46) 26 CoreFoundation 0x000000019632ff04 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1972) 27 CoreFoundation 0x0000000196340c90 __CFRunLoopDoSource0 + 208 (CFRunLoop.c:2016) 28 CoreFoundation 0x000000019627a184 __CFRunLoopDoSources0 + 268 (CFRunLoop.c:2053) 29 CoreFoundation 0x000000019627fb4c __CFRunLoopRun + 828 (CFRunLoop.c:2951) 30 CoreFoundation 0x00000001962936b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268) 31 GraphicsServices 0x00000001b232d374 GSEventRunModal + 164 (GSEvent.c:2200) 32 UIKitCore 0x0000000198bf8e88 -[UIApplication _run] + 1100 (UIApplication.m:3511) 33 UIKitCore 0x000000019897a5ec UIApplicationMain + 364 (UIApplication.m:5064) 34 app 0x0000000104cd277c main + 388 (main.mm:38) 35 dyld 0x0000000109919ce4 start + 520 (dyldMain.cpp:879)
Posted
by codefei.
Last updated
.
Post not yet marked as solved
4 Replies
596 Views
I can create a new JSContext and use this to perform JavaScript operations. But if I want to shut down the JS Core after I have finished with it (without killing the app this is running in) I can find no means of doing that. Is there a way to get the iOS system to release all memory/resources associated with the JSCore after I have finished with it? The Apple docs at https://developer.apple.com/documentation/javascriptcore/jscontext don't provide any guidance for how to remove the JS Core after use. Maybe I am missing something. I did also look at the underlying JSVirtualMemory instance, but again there is no obvious way to shut this down and release all memory. If I simply dereference the JSContext instance, I would have hoped that this might trigger cleanup but it does not.
Posted Last updated
.
Post not yet marked as solved
1 Replies
946 Views
I ran a series of CPU-intensive tests, with code written in JavaScript on my iPad. I can execute the JavaScript code using either JavaScriptCore, or by using a WkWebView and making it load and execute the JavaScript. I found that JavaScriptCore is 12 to 15 times slower than WKWebView (18.3 s instead of 1.1 s). That seems huge. Is there any way to speed it up? Is there any reason why it's so slow? While we're at it, are there differences between the WebAssembly engine in JavaScriptCore and the one in WkWebView?
Posted Last updated
.
Post not yet marked as solved
3 Replies
4.4k Views
My iOS app is crashing on the initial load. It's happening both in my Testflight build and also in the production version of the app on the App Store. It was working fine a few days ago; this just started happening all of a sudden. What's strange is that after doing a fresh install, it doesn't happen the first time I open the app. It only happens after I force close the app and open it again (and every time afterward). I'm using Expo and React Native to build the app. I've attached a crash log. crash log - https://developer.apple.com/forums/content/attachment/6a5962a1-56ac-44b0-8ec4-4e8dee0daee8
Posted Last updated
.
Post not yet marked as solved
0 Replies
833 Views
I am facing a strange issue, this is related to PWA apps. So, when the user opens the link in the browser and then clicks on appleid.apple.com then it's working fine but when the user adds the link on the home screen and launches the app from the home screen then clicks on appleid.apple.com then its redirects to AppStore. (https://i.stack.imgur.com/ikV5Q.png) I tried every possible solution (windows.open, changed target, use a href), but nothing seems to be working. I want if the user clicks on the appleid.apple.com from the home screen app then it should open in InAppBrowser, this should not redirected to AppStore
Posted Last updated
.