Summary:
If we use RCTLogError, we show a redbox with a native stacktrace before we can actually show the JS stacktrace (which is only done through dispatch_async). Instead use RCTLogWarn so its logged to console but not reported as a redbox.
Also fix call to RCTNSErrorFromJSErrorRef off the main thread RCTJSCExecutor.
Reviewed By: majak, mmmulani
Differential Revision: D3886813
fbshipit-source-id: 119d04858cb0c85c79e12ff8a79806711f8e0b27
Summary: Get rid of the old behaviour of JSON encoding in `nativeRequireModuleConfig` and consistently use the same names for function types "async/promise/sync"
Reviewed By: lexs
Differential Revision: D3819348
fbshipit-source-id: fc798a5abcaf6a3ef9d95bd8654afa7825c83967
Summary: Add some additional perf markers, and remove the usage of RCTProfileBlock as it completely breaks debugging / stepping in those blocks.
Reviewed By: majak
Differential Revision: D3579900
fbshipit-source-id: 8846dfc39b2448daa3669d5e1e8efb9096f183c5
Summary: No need to specify duplicative information.
Reviewed By: javache
Differential Revision: D3550805
fbshipit-source-id: b5abc3f1c74e26b4d4641c29fedba189cc46406e
Summary: This prevents the `isUnbundle` check to read beyond the end of an `NSData` instance by using `getBytes:length:` instead of accessing the underlying buffer directly.
Reviewed By: javache
Differential Revision: D3548874
fbshipit-source-id: 7c93c66cc6abb4a2a321888ab394212f4d14a03e
Summary:
The `initWithJSContextProvider:` API created a `RCTJSCExecutor` with a thread/context that already exists, but it did not solve the problem of loading an actual application script; the `executeApplicationScript:` API is also asynchronous.
Create a new merged API that allows you to pass in a pre-created thread/context pair and immediately receive an `RCTJSCExector` that has already executed a specified application script.
This also removes the `underlyingJSContext` API entirely, in favor of passing it back in a byref variable in the new API. This minimizes the surface area for API abuse.
Reviewed By: bnham
Differential Revision: D3545349
fbshipit-source-id: 1c564f44d2a5379b5e6f75640079a28fd7169f67
Summary:
Instead of two separate dispatches to the JavaScript thread, only do one. Avoid the strongSelf dance entirely.
This refactor does mean that the cost of registering the nativeRequire hook on the context is not measured by the `RCTPLRAMBundleLoad` tag. However it should be almost zero-cost to construct and set a single block, so I'm OK with that change.
Reviewed By: bnham
Differential Revision: D3542940
fbshipit-source-id: d6bd26e478d0d33b56f8116d7efe6aac80c91711
Summary: This makes the state it uses more explicit. It also makes a bug with performance measurement obvious: if we early return to error, we never mark stop for `RCTPLRAMStartupCodeSize`.
Reviewed By: javache
Differential Revision: D3542751
fbshipit-source-id: e6c1e3f3a76098ca37b8078f6e9abc805ad2d9da
Summary: This can be used to create a JavaScript thread and `JSContext` in advance, then supply them to the `RCTJSCExecutor` at creation time later.
Reviewed By: javache
Differential Revision: D3534553
fbshipit-source-id: 99ccf711928cd12e84c9fbe142c6d19a7af55d07
Summary: This was left over from a previous change.
Reviewed By: javache
Differential Revision: D3534376
fbshipit-source-id: 6932364d1c32d8fbdf56c642893f9ea5e6dc1fee
Summary:
In practice, it *MUST* be the call to `self.context` within `setUp` that triggers the creation of the context:
- It can't come before that point because `_jscWrapper` has not been set up yet
- It can't come after that point since `self.context` would create the context there.
Just move the creation to be inline, enforced by assert. This makes it easier to reason about where the context is created, and easier to change how it is created later.
Reviewed By: javache
Differential Revision: D3529843
fbshipit-source-id: 8ed5a9861ebefd4b9e0f7155db8587dcf0442b7a
Summary: There's no reason for this; setUp is once-and-done. Probably just trying to ignore the incorrect clang warning.
Reviewed By: javache
Differential Revision: D3528494
fbshipit-source-id: e4f986df8d097e4720dfd4a51e7fb6c9c9b5108f
Summary: I think this obscures more than it helps. Remove it.
Reviewed By: javache
Differential Revision: D3528677
fbshipit-source-id: d90a636a6e34b66563d9a02e255c6ebc4cee1294
Summary:
Ideally, native hooks should not require any sort of reference to self. Pull all those that fulfill this criteria into a class method (to make it impossible to accidentally capture self).
Future diffs will pull more and more hooks into this category.
Reviewed By: javache
Differential Revision: D3528558
fbshipit-source-id: 270c5bec53674a91ec2129d55e5cad59440a51da
Summary: It's just a simple helper. It's actually more readable and performant when inlined.
Reviewed By: javache
Differential Revision: D3528540
fbshipit-source-id: 8086770f7fd88b40623dc943c715deb4f9fd9262
Summary: It's not widely used, and you can do something equivalent anyway by using existing public API.
Reviewed By: javache
Differential Revision: D3518896
fbshipit-source-id: 6995a5d840aecfff4ffd78ac43f3f592a4f47f91
Summary:
We already do this on Android, and it allows uw to avoid doing this global object lookup for every call. Since there's only a couple of global functions we ever call, we should consider caching all of them in the new bridge.
I didn't ValueProtect/ValueUnprotect since these are already globals, and those methods are not exposed on the JSC wrapper.
Reviewed By: mhorowitz
Differential Revision: D3411487
fbshipit-source-id: 7feaf8803665b77d649e84edad875d31c5acee4b
Summary: Expose the ability to provide extra information to Systrace events from JS. This is specifically useful for instrumenting generic recursive method that are defined completely through their params.
Reviewed By: tadeuzagallo
Differential Revision: D3423595
fbshipit-source-id: 7f2dedf02bf901401a6b391b85b1a0bb6782349c