Skip to content

Commit 29d2c0b

Browse files
committed
Disable JSValueUnprotect to see if it fixes crashes
1 parent 0c2169b commit 29d2c0b

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

Sources/SkipScript/JSContext.swift

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,18 @@ let JavaScriptCore: JavaScriptCoreLibrary = JavaScriptCoreLibrary.instance
1616

1717
public typealias ExceptionPtr = UnsafeMutablePointer<JSValueRef?>
1818

19-
/// JIT needs to be disabled on Android to avoid random crashes in `JSValueUnprotect`
20-
/// See: https://github.com/WebKit/WebKit/blob/main/Tools/Scripts/run-jsc-benchmarks
21-
private func disableJIT() {
22-
// JSC_useWasmIPInt=0 JSC_useWasmLLInt=1 JSC_useWebAssembly=1 JSC_useJIT=0
23-
#if SKIP
24-
android.system.Os.setenv("JSC_useJIT", "false", true)
25-
#else
26-
//setenv("JSC_useJIT", "false", 1) // no need: iOS doesn't support JIT anyway :)
27-
#endif
28-
}
29-
3019
/// A context for evaluating JavaScipt.
3120
public class JSContext {
3221
public let context: JSContextRef
3322
public private(set) var exception: JSValue? = nil
3423
private var tryingRecursionGuard = false
3524

3625
public init(jsGlobalContextRef context: JSContextRef) {
37-
disableJIT()
3826
self.context = context
3927
JavaScriptCore.JSGlobalContextRetain(context)
4028
}
4129

4230
public init() {
43-
disableJIT()
4431
self.context = JavaScriptCore.JSGlobalContextCreate(nil)
4532
}
4633

@@ -575,7 +562,7 @@ public class JSValue {
575562
02-06 14:33:12.997 2016 2016 F DEBUG : #11 pc 0000000000185e6b /apex/com.android.art/lib64/libart.so (art_quick_osr_stub+27) (BuildId: 1dfb27162fe62a7ac7a10ea361233369)
576563
02-06 14:33:12.997 2016 2016 F DEBUG : #12 pc 00000000003d27ba /apex/com.android.art/lib64/libart.so (art::jit::Jit::MaybeDoOnStackReplacement(art::Thread*, art::ArtMethod*, unsigned int, int, art::JValue*)+410) (BuildId: 1dfb27162fe62a7ac7a10ea361233369)
577564
*/
578-
JavaScriptCore.JSValueUnprotect(context.context, value)
565+
//JavaScriptCore.JSValueUnprotect(context.context, value)
579566
}
580567
}
581568

0 commit comments

Comments
 (0)