Commit Graph

213 Commits

Author SHA1 Message Date
Indragie Karunaratne b4dbf2b477 Read bytecode format version from custom JSC executor only if custom JSC is enabled
Reviewed By: javache

Differential Revision: D4230129

fbshipit-source-id: d28e475d3a55320285a45f54b7ea495229be364d
2016-11-27 11:43:30 -08:00
Pieter De Baets f2a46b17d4 Replace RCTJSCWrapper with JSCWrapper from ReactCommon
Reviewed By: mhorowitz

Differential Revision: D4204516

fbshipit-source-id: 6bcb122daf2848035dfae404ee7a2e9aca0f8087
2016-11-23 11:43:48 -08:00
Pieter De Baets e1577df1fd Move all header imports to "<React/..>"
Summary:
To make React Native play nicely with our internal build infrastructure we need to properly namespace all of our header includes.

Where previously you could do `#import "RCTBridge.h"`, you must now write this as `#import <React/RCTBridge.h>`. If your xcode project still has a custom header include path, both variants will likely continue to work, but for new projects, we're defaulting the header include path to `$(BUILT_PRODUCTS_DIR)/usr/local/include`, where the React and CSSLayout targets will copy a subset of headers too. To make Xcode copy headers phase work properly, you may need to add React as an explicit dependency to your app's scheme and disable "parallelize build".

Reviewed By: mmmulani

Differential Revision: D4213120

fbshipit-source-id: 84a32a4b250c27699e6795f43584f13d594a9a82
2016-11-23 07:58:39 -08:00
David Aurelio 5db7484e8d Move `ScriptTag` and `RCTJSModulesUnbundle` to `cxxreact`
Reviewed By: javache

Differential Revision: D4213662

fbshipit-source-id: fc2ec9717c24fe77bb022a48777049f88173ebeb
2016-11-23 06:43:50 -08:00
Pieter De Baets 41810008b7 Inject custom JSC wrapper from FBReactModule
Reviewed By: bnham

Differential Revision: D4197674

fbshipit-source-id: b195ff1dc850981be36ecb3080b131d03df85a4a
2016-11-23 03:58:41 -08:00
Pieter De Baets bcac6e7d39 Cleanup RCTSourceCode
Reviewed By: mmmulani

Differential Revision: D4124428

fbshipit-source-id: 0db5bfd5897c37c11374fe90516ac7aeb2ae5d53
2016-11-18 05:13:31 -08:00
Dan Caspi 3b4ac79583 Exposing RCTDevMenuItem when not in DEV mode and adding a missing header
Reviewed By: javache

Differential Revision: D4189179

fbshipit-source-id: c9ad45b20bab884e5d0fcd17efc494fc37ab7d92
2016-11-16 07:28:32 -08:00
Dan Caspi b123cc279e Another fix
Reviewed By: benhiller

Differential Revision: D4185166

fbshipit-source-id: 940dbfbd65c94455979c7e88375784a5c68647a5
2016-11-15 14:58:36 -08:00
Dan Caspi 9fc6204efc Add support for JSC's sampling profiler on iOS for RN
Reviewed By: javache

Differential Revision: D4107919

fbshipit-source-id: ecfe2cacdb78b857e461f7006b29e4d1fe1a1862
2016-11-15 09:29:06 -08:00
Martin Konicek 7991d1206b Revert import from D4133936 (13aba8)
Summary:
This broke the open source build: http://imgur.com/a/1Btd1

javache tells me reverting this line should fix it.

Reviewed By: javache, ericvicenti

Differential Revision: D4178951

fbshipit-source-id: c680de6b3b48bf137294dfe053afaff7b0613caf
2016-11-14 16:28:55 -08:00
Indragie Karunaratne 13aba82a2b Add more functions to RCTJSCWrapper + make it a public header
Reviewed By: javache

Differential Revision: D4133936

fbshipit-source-id: 04951965099598f7058cb0005267712c276582b9
2016-11-14 09:13:40 -08:00
Ashok Menon 58aa9afaed BC Kill-switch
Reviewed By: javache

Differential Revision: D4159923

fbshipit-source-id: 9814c76d04f7230fda7693efac3f6623cc882ccf
2016-11-11 05:29:30 -08:00
Ashok Menon 8288bc2006 BC Soft Errors
Reviewed By: javache

Differential Revision: D4131340

fbshipit-source-id: b0827fc99d94985fbbb2a1b03ddc4d6feab10bff
2016-11-11 05:29:25 -08:00
Ashok Menon 3ee5e97bcd Removing redundant `if`.
Reviewed By: javache

Differential Revision: D4139894

fbshipit-source-id: 457f6b2b0b448af1dd75faa1c1b350e36d7a3133
2016-11-08 09:13:43 -08:00
Dan Caspi 47d9cb4dac Setting runtime options for JSC on iOS
Reviewed By: michalgr

Differential Revision: D4104084

fbshipit-source-id: 517f833343948c59e5f77cede8a60574ca1e40c0
2016-11-08 08:43:38 -08:00
Ashok Menon 227f1b0ea8 Decoupling initialisation and synchronous execution.
Reviewed By: javache

Differential Revision: D4117471

fbshipit-source-id: b00de532c99f041ebba8b9d74972a36827a1a3f4
2016-11-03 10:58:43 -07:00
Dan Caspi 8287e3e83f Added a way to handle functions that are not supported by the system JSC
Reviewed By: javache

Differential Revision: D4110660

fbshipit-source-id: 27c99cae96b57f70ddc1d310c6d5343d7c3c8892
2016-11-02 09:43:58 -07:00
Ashok Menon 1a75ba3c67 Expose BC version
Reviewed By: javache

Differential Revision: D4110361

fbshipit-source-id: 6cde7d8ca26d30a804f1a99cf9380dcbc0ff5541
2016-11-01 10:28:55 -07:00
Ashok Menon ace32e650c Refactoring JSC Wrapper
Reviewed By: javache

Differential Revision: D4110360

fbshipit-source-id: 5a8bda7cf005dc340ad18a559f8bf0da8d4075d1
2016-11-01 10:28:55 -07:00
Ashok Menon 16290851aa Recognise and run BC bundles
Reviewed By: javache

Differential Revision: D4067425

fbshipit-source-id: fade9adebfa8a59dc49aeadfd01a782f7b686082
2016-11-01 10:28:55 -07:00
Nikhilesh Sigatapu c67225818d Add a way to access the underlying JavaScriptCore context
Summary:
**Motivation**

I'm working on a project that uses React Native and needs to add direct synchronous bindings to native stuff through the JavaScriptCore C API. This is because it's performance-sensitive and would benefit from the quickest JS->C path. It does this using cross-platform C++ code that works on both iOS and Android. Most of the infrastructure for getting access to the JSC context is already in React Native actually, just had to add a few more things.

(lexs you mentioned to tag you in this pull request)

**Test plan**

Modify the JavaScriptCore context through the `JSContextRef` returned (eg. add an object at global scope) and verify that it exists in JavaScript.
Closes https://github.com/facebook/react-native/pull/10399

Differential Revision: D4080945

Pulled By: lexs

fbshipit-source-id: 6659b7a01e09fd84475adde183c1d3aca2d4cf09
2016-10-26 03:43:44 -07:00
Pieter De Baets 8355ef91ad Add a default context name to RCTJSCExecutor
Reviewed By: mmmulani

Differential Revision: D4015748

fbshipit-source-id: 077287b8438aa13f2a1479d68eacb0662bf295aa
2016-10-14 11:43:43 -07:00
Dan Caspi ce179d4b43 Properly removing bytecode caching from iOS
Reviewed By: alexeylang

Differential Revision: D4003142

fbshipit-source-id: 9decdba54417bce8240a5e8f34c0c32b16c9f494
2016-10-13 06:58:45 -07:00
Dan Caspi 9408461405 Disabling bytecode caching for custom JSC
Reviewed By: michalgr

Differential Revision: D4002399

fbshipit-source-id: 7ac836873ee4b0d5fc0e9529d7e4257fe577e852
2016-10-11 13:43:42 -07:00
Dan Caspi 1c23b70929 Add support for custom JSC across CS
Reviewed By: javache

Differential Revision: D3944510

fbshipit-source-id: 1c67c8a53a65149250a602f2ccd6b234a022897f
2016-10-07 07:58:46 -07:00
Dan Caspi dfcfb90baa Fix [JSValue ...] & [JSContext ...] access with custom JSC
Reviewed By: bnham

Differential Revision: D3859956

fbshipit-source-id: 966aba9a267371eb553b8be574fa247b21930d1c
2016-09-27 09:43:30 -07:00
Pieter De Baets 339531065f Fix some linter warnings
Reviewed By: majak

Differential Revision: D3930059

fbshipit-source-id: dbbf67f287c46535f9c5947cd7ac101c5c91615e
2016-09-27 06:13:31 -07:00
Pieter De Baets 31b158c9fe Export native modules without RCT or RK prefix
Reviewed By: mmmulani

Differential Revision: D3901600

fbshipit-source-id: 7d4a027f0f2478e2a9ac9916326b91279bec3cb3
2016-09-23 11:14:11 -07:00
Yiding Jia bb933c8ad4 Make custom jsc initialization a link-time replacable function.
Reviewed By: bnham

Differential Revision: D3880106

fbshipit-source-id: 2a3c3c8ff120ecc66b31325700c187cbd957f361
2016-09-20 16:58:42 -07:00
Pieter De Baets 21fda19ca9 Consistently handle startup errors
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
2016-09-20 06:28:36 -07:00
Pieter De Baets 9ff4d31dc4 Remove unnecessary JSContextGetGlobalContext call
Reviewed By: majak, alexeylang

Differential Revision: D3871178

fbshipit-source-id: 4a6dff7cce233e9bc2e2a80858774a2e6af6b67d
2016-09-16 06:28:48 -07:00
Pieter De Baets 228f104dad Improve RCTNSErrorFromJSError
Reviewed By: adamjernst

Differential Revision: D3871146

fbshipit-source-id: 44de849852d8c00ab4589938ef317e4c8d98d7e6
2016-09-16 06:28:48 -07:00
Pieter De Baets 95cce07baf Support invoking method that returns result and flushes call queue
Reviewed By: mhorowitz

Differential Revision: D3870879

fbshipit-source-id: bc8f70d9866dfc25468c9072c209cc6842b98575
2016-09-16 06:28:48 -07:00
Pieter De Baets d6926c5468 Allow precreated JSC executor init without applicationScript
Reviewed By: mmmulani

Differential Revision: D3836643

fbshipit-source-id: 18937ef5b39ebe3b3fd743490f86e40ffa6ee015
2016-09-13 06:43:40 -07:00
Alexey Lang d6fe78fc25 Refactor measuring native requires
Reviewed By: javache

Differential Revision: D3829204

fbshipit-source-id: 9a3a29bfc12e3af60eeac1e03b93a626d0d256c8
2016-09-09 15:28:44 -07:00
Pieter De Baets 99e0267c25 Cleanup and document native module configuration
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
2016-09-08 04:13:51 -07:00
Pieter De Baets 1a7c231ef3 Remove last arg from RCTProfileEnd, make macro's function-like
Reviewed By: tadeuzagallo

Differential Revision: D3801302

fbshipit-source-id: 297a58db876366e21e232094c1361aa0dcd9016d
2016-09-05 11:13:33 -07:00
Pieter De Baets dda3c5f48d Support sync method calls in the objc bridge
Reviewed By: mhorowitz

Differential Revision: D3801188

fbshipit-source-id: b990680049a46840472a25e66882f8a29890ae90
2016-09-05 07:44:00 -07:00
Indragie Karunaratne 31c8e20c8e Remove -[RCTJSExecutor errorForJSError:]
Reviewed By: javache

Differential Revision: D3814718

fbshipit-source-id: 9b8c91cb81d77fda4959df26806d54c9b7be42a0
2016-09-02 17:43:37 -07:00
Ben Nham 7db93a376b configure glog sink for custom jsc
Reviewed By: alexeylang

Differential Revision: D3789493

fbshipit-source-id: b3ecbd1caddfeef5e948e43444be95207c573f67
2016-08-31 11:29:05 -07:00
Ben Nham 4ad01be3a0 Remove iOS 7 version check in RCTJSCWrapperCreate
Reviewed By: michalgr

Differential Revision: D3729175

fbshipit-source-id: 43ee2ba19b3d8fed20bd268d1e2d0fab83e2fe9f
2016-08-18 03:28:34 -07:00
Ben Nham 53c5c4f8c3 Rename custom JavaScriptCore.framework to JSC.framework
Reviewed By: michalgr

Differential Revision: D3709748

fbshipit-source-id: bc2a7124127944c5d24e584747074065eefa1207
2016-08-15 15:13:40 -07:00
Ben Nham d22003a0de dynamically load JavaScriptCore with RTLD_LOCAL option
Reviewed By: tadeuzagallo

Differential Revision: D3703415

fbshipit-source-id: c67865b7fe75c21a3b620dc3a794b5a0005cf71e
2016-08-13 03:31:08 -07:00
Ben Nham ce2f119222 fix loading of dynamic linked JavaScriptCore on iOS simulator
Reviewed By: michalgr

Differential Revision: D3703392

fbshipit-source-id: 670185de1eefd1c542de2df96e40aede3b2c12cc
2016-08-11 18:43:27 -07:00
Pieter De Baets 335132ad63 Fix some analyzer warnings
Reviewed By: majak

Differential Revision: D3683672

fbshipit-source-id: 879578b050186bc779d01a17822d41bf7e473123
2016-08-09 03:58:36 -07:00
Pieter De Baets e762d961cd Use new enqueueJSCall method everywhere
Reviewed By: majak

Differential Revision: D3605263

fbshipit-source-id: 215f896d675b937593c8b796ed6ec5261ac74dbf
2016-08-02 11:14:06 -07:00
Pieter De Baets 63e0e6c7e4 Add more profiling markers to RCTJSCExecutor
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
2016-07-19 07:28:34 -07:00
Pieter De Baets 7fa677f7c3 Add MessageQueue method for executing function and returning its result
Reviewed By: majak

Differential Revision: D3175793

fbshipit-source-id: e1e66e3dcde8b1fb35973340e12d947a0e955775
2016-07-18 07:13:32 -07:00
Adam Ernst 3b4120d595 Simplify JS error to NSError API
Summary: No need to specify duplicative information.

Reviewed By: javache

Differential Revision: D3550805

fbshipit-source-id: b5abc3f1c74e26b4d4641c29fedba189cc46406e
2016-07-13 08:28:34 -07:00
David Aurelio c33084cc94 Read within bounds of `NSData` object
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
2016-07-12 10:13:24 -07:00