Граф коммитов

141 Коммитов

Автор SHA1 Сообщение Дата
Nicola Corti 26a54169f2 Remove unused Makefiles from React Native core
Summary:
This diff cleans up several Android Makefiles which we're not using anymore
as they've been replaced by CMake files.

There are still 3 Makefiles left, which I'm aiming to remove in the near future.

Changelog:
[Internal] [Changed] - Remove unused Makefiles from React Native core

Reviewed By: javache

Differential Revision: D36660902

fbshipit-source-id: 8afffac74d493616b0f9414567821cd69f4ef803
2022-05-25 07:54:06 -07:00
Anand Bashyam da48d0dc63 Back out "Revert D35705825: [JSI] Fix typo in Value's constructor with a Symbol"
Summary:
During the sheriff shift, incorrectly reverted a diff. fixing it by reverting the revert.

Original commit changeset: b5a6c9f6f576
Original Phabricator Diff: D35705825 (a7a0f86a73)

See : https://fb.workplace.com/groups/mobile.sheriffs/posts/8461935673854973/?comment_id=8462686143779926

The current JSI implementation is converting a Symbol to String when creating a jsi Value.
Changelog: [General][Fixed]

Reviewed By: neildhar

Differential Revision: D35710710

fbshipit-source-id: d36667001002032a37569c9bc5288d10b9bc7011
2022-04-18 10:08:22 -07:00
Anand Bashyam 82f2b1d4e9 Revert D35705825: Fix typo in Value's constructor with a Symbol
Differential Revision:
D35705825 (a7a0f86a73)

Original commit changeset: 3bee0a02bb77

Original Phabricator Diff: D35705825 (a7a0f86a73)

fbshipit-source-id: b5a6c9f6f576ea1771dca8977b394bd90064c669
2022-04-17 12:51:12 -07:00
John Porto a7a0f86a73 Fix typo in Value's constructor with a Symbol
Summary:
The current JSI implementation is converting a Symbol to String when creating a jsi Value.

Changelog: [General][Fixed]

Reviewed By: neildhar

Differential Revision: D35705825

fbshipit-source-id: 3bee0a02bb77643c6a33031b4d98ac9a7e126303
2022-04-17 11:53:12 -07:00
Alex Landau 9bac0b77d0 Fix warnings about inconsistent override keyword
Summary:
The `override` keyword was used for some overriden methods and was not
used for others. This caused the `-Winconsistent-missing-destructor-override`
warning to show up, and since in some cases we build with `-Werror`, this broke
the build.

This diff adds the missing `override` keyword in a few places.

Changelog:
[Internal][Fixed] - Build issues

Reviewed By: kodafb

Differential Revision: D35513149

fbshipit-source-id: 92bca699f1be163189487d50c1050402df2ff038
2022-04-11 16:19:51 -07:00
Chris Olszewski daa105aba5 Fixup typo in pfh labels
Summary:
Now that the PFH node has been renamed this updates the pfh label.

Produced via `xbgs -l -e '"pfh:ReactNative_CommonInfrastructurePlaceholde"' | xargs sed -i 's/"pfh:ReactNative_CommonInfrastructurePlaceholde"/"pfh:ReactNative_CommonInfrastructurePlaceholder"/'`

Reviewed By: jkeljo

Differential Revision: D35374087

fbshipit-source-id: 61590f69de5a69ec3b8a0478f6dd43409de3c70b
2022-04-05 12:15:05 -07:00
Chris Olszewski ceae48c0f7 Add pfh labels to targets
Summary:
While it would be better to be able to do all of the ownership metadata at the Buck macro level, that proved to be more work than expected.

This diff adds the corresponding pfh label to all targets in `xplat/js/react-native-github` that have a Supermodule label. Once the migration is complete the Supermodules labels will be able to be removed.

Reviewed By: cortinico

Differential Revision: D35221544

fbshipit-source-id: d87d5e266dfb5e6ee087251dc34dff5db299bbaf
2022-03-30 14:37:03 -07:00
Joachim Reiersen 12a32549f4 Fix jsi test compilation under gtest 1.10
Summary: Changelog: [Internal] - Fix test compilation with gtest 1.10

Reviewed By: jiawei-lyu

Differential Revision: D35058207

fbshipit-source-id: 2cbcfad00992fee646d3c2d701af9ebdfb7b4f2e
2022-03-22 14:35:57 -07:00
Phillip Pan 982ca30de0 bump iOS and tvOS from 11.0 to 12.4 in cocoapods
Summary:
Changelog: [iOS][Deprecated] Deprecating support for iOS/tvOS SDK 11.0, 12.4+ is now required

allow-large-files

Reviewed By: sammy-SC

Differential Revision: D34547333

fbshipit-source-id: a24bb09d03939a092de4198efb1aa4a44c69f718
2022-03-16 21:08:01 -07:00
Andrei Shikov e5874d90e2 Folly_runtime for CMake
Summary:
Ports improvements from Android.mk setup to CMake, replacing folly_json and futures with runtime where plausible

Changelog: [Internal] - CMake folly_runtime setup

Reviewed By: cortinico

Differential Revision: D34854295

fbshipit-source-id: fa882a9cd0b78feb20f8abcc9350c27702375def
2022-03-16 08:10:55 -07:00
Nicola Corti e12bc9cf62 Setup Globbing with CONFIGURE_DEPENDS inside CMake files.
Summary:
This Diff moves from specifying a list of files to use file(GLOB) with
CONFIGURE_DEPENDS on several CMakefiles.
I've updates those where we use globbing also inside buck.

Changelog:
[Internal] [Changed] - Setup Globbing with CONFIGURE_DEPENDS inside CMake files

Reviewed By: ShikaSD

Differential Revision: D34826311

fbshipit-source-id: 8fc654626c897cdc4cdd79c699ce19f1e5e1212f
2022-03-15 01:55:27 -07:00
Andrei Shikov 5d5addd661 Separate folly into runtime + folly_futures specific for hermes inspector
Summary:
Rearranges folly_futures configuration into a static library only required for `hermes-inspector` + `folly_runtime` which merges `folly_json` and mutex-related implementations `folly_futures` was used for. As `hermes-executor-debug` is removed by `vmCleanup` configurations later, it allows to shave additional 300KB from the release APK size.

Changelog: [Internal] - Rearrange folly build to reduce APK size

Reviewed By: cortinico

Differential Revision: D34342514

fbshipit-source-id: b646680343e6b9a7674019506b87b96f6007caf2
2022-03-13 15:15:21 -07:00
Nicola Corti b676ca560d First Round of CMake files for React Android
Summary:
This is the first round of CMake files to support the React Native build on Android.
They're supposed to eventually replace the various Android.mk files we have around in the codebase.

So far we're not actively using them. This is the first step towards migrating our
setup to use CMake

Changelog:
[Internal] [Changed] - First Round of CMake files for React Android

Reviewed By: ShikaSD

Differential Revision: D34762524

fbshipit-source-id: 6671e203a2c83b8874cefe796aa55aa987902a3b
2022-03-11 11:39:23 -08:00
Daniel Andersson e1dc9a756b Silence some warnings in xcode 13.3
Summary:
Silence some warnings in xcode 13.3 by explicitly defining some copy constructors in JSI and adding a compiler flag in Hermes.

Changelog:
[Internal][Fixed] - Build issues

Reviewed By: jpporto

Differential Revision: D34526541

fbshipit-source-id: 7029e3d20b9209007cf7e9f4c935338513ee1dd0
2022-03-07 11:52:51 -08:00
Scott Kyle 603620b739 Add asBool() method
Summary:
Changelog:
[General][Added] - Add asBool() method to JSI

Reviewed By: mhorowitz

Differential Revision: D34630901

fbshipit-source-id: 3007784618fcc0f7828eee42de5cbf2bd71258c5
2022-03-04 08:02:17 -08:00
Neil Dhar 9010bfe457 Add PropNameID::fromSymbol
Summary:
Changelog:
[General][Added] - Add ability to access properties with symbol keys through JSI

Reviewed By: mhorowitz

Differential Revision: D33830544

fbshipit-source-id: 8de366b4c7d5ea9d2fd5df70dfb776a056e23806
2022-02-14 22:29:16 -08:00
John Porto b467094f18 Add StringPrimitive::create for UTF8 strings
Summary:
This is pre-work for adding the v8 stack trace API support.

Changelog: [Internal]

Reviewed By: kodafb

Differential Revision: D34048366

fbshipit-source-id: 9d2b469767f7669cb428c61b215f193894892c03
2022-02-10 05:00:32 -08:00
Neil Dhar 5b66bb90c6 Add missing symbol handling in kindToString
Summary: Changelog: [Internal]

Reviewed By: kodafb

Differential Revision: D34062869

fbshipit-source-id: 08fed59d62b0d0a46e0868874a89b125731a44e5
2022-02-08 15:18:15 -08:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Christoph Purrer 5dcad6a116 jsi.h Fix typo
Summary:
Changelog:
[Internal][Fixed] - I have been reading this header file recently and discovered some typos

Reviewed By: kodafb

Differential Revision: D32455214

fbshipit-source-id: c27291943476014b787ee1641fd8642056bdbc5a
2021-11-16 08:56:53 -08:00
Joshua Gross b60e229d7f Remove compiler_flags from BUCK modules
Summary:
Nearly all of these are identical and these compiler_flags are now centralized in rn_defs.bzl. This should have NO CHANGE on build configuration, the flags have just moved for now.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D31631766

fbshipit-source-id: be40ebeb70ae52b7ded07ca08c4a29f10a0ed925
2021-10-14 15:34:29 -07:00
Kevin Gozali b0c8a4eee8 Link RCT-Folly against libc++abi
Summary:
Folly now depends on libc++abi. This solves linker error for RCT-Folly.podspec like this:

```
Undefined symbols for architecture arm64:
  "___cxa_increment_exception_refcount", referenced from:
      folly::exception_ptr_get_type(std::exception_ptr const&) in libRCT-Folly.a(Exception.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

See https://github.com/react-native-community/releases/issues/251

Note: RNTester was not affected by this bug for some reason, so the only way to verify is via the new app generated via `npx react-native init`.

Changelog: [Fixed][iOS] Unbreak Folly linker error

Reviewed By: lunaleaps

Differential Revision: D30950944

fbshipit-source-id: 3eb146e23faa308a02363761d08849d6801e21ca
2021-09-16 22:24:10 -07:00
Neil Dhar 1bc885b8b8 Make JSI a dynamic library
Summary:
Ship libjsi as a standalone dynamic library. This prevents problems
with exception handling caused by duplicate typeinfo across multiple
shared libs, and reduces bundle size by removing duplicate copies of
JSI.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D30599215

fbshipit-source-id: abad1398342a5328daa825f3f684e0067cad7a96
2021-08-27 17:16:49 -07:00
Chatura Atapattu 8258f5e271 Remove BUILD FILE SYNTAX from build files
Summary: Changelog: [Internal]

Reviewed By: zertosh

Differential Revision: D30410441

fbshipit-source-id: 62deebb502121f23270bfa18286b155ad161af2d
2021-08-19 15:25:19 -07:00
Kudo Chien b77948e33b Upgrade folly to 2021.06.28.00 and boost to 1.76.0 (#31840)
Summary:
1. [ios] upgrade folly to 2021.06.28.00 which aligned to android.
2. folly compile setting from c++14 -> c++17: _this folly requires c++17 for `std::unordered_map::insert_or_assign`._
3. boost 1.63.0 -> 1.76.0:  _the old boost does not support c++17._
4. deprecating react-native-community/boost-for-react-native: _by cocoapods installer, we could download the official target._

## Changelog

[iOS] [Changed] - Upgrade folly to 2021.06.28.00 and boost to 1.76.0

Pull Request resolved: https://github.com/facebook/react-native/pull/31840

Test Plan: CI passed

Reviewed By: fkgozali

Differential Revision: D29668480

Pulled By: yungsters

fbshipit-source-id: 98eae9ca47f489dcea91974e6f5e9dcb4d66c40c
2021-07-16 15:13:12 -07:00
Neil Dhar 257e83f664 Remove custom MAP_TAG from FileBuffer
Summary:
Custom tags made with `VM_MAKE_TAG` are meant to be used to tag
anonymous mappings, and should be passed in as the file descriptor.
We can't use them for file backed mappings.

Changelog: [Internal]

Reviewed By: kodafb

Differential Revision: D29038256

fbshipit-source-id: 11324a3e798e695709d7d340e84e5fe6f7ffaad3
2021-06-18 12:01:00 -07:00
Peter Argany 36b58a824e Bump Flipper-Folly to 2.5.3 and RCT-Folly to 2021.04.26.00
Summary:
This fixes an error where folly fails to build on Xcode 12.5, by bumping the various folly deps in RN to builds with a fix.

Next step is to commit this to 0.64 release branch

allow-large-files

Changelog: [iOS] Fix builds on Xcode 12.5

Reviewed By: fkgozali

Differential Revision: D28071808

fbshipit-source-id: 236b66bf8294db0c76ff25b11632c1bf89525921
2021-04-29 10:39:25 -07:00
Xuan Huang bddff73790 Introduce drainMicrotasks to JSI
Summary:
Changelog:
[Internal][Added] - Introduce drainMicrotasks to JSI

This diff proposed a new JSI API `drainMicrotasks` to define
how hosts may integrate with the JSVMs' internal microtask
queue (a.k.a. job queue) and hence their native Promise.

The name `drainMicrotasks` is slightly preferred over `drainJobs`
to favor *host-friendliness* over *engine-friendliness*.

This diff auto implement the new API in JSC and Hermes as stubs
to make sure things compiled.

Please refer to the doc-comments in the `jsi.h` for a detailed
documentation on the semantics and the design of this API.

### Notes on the existing APIs from JSVMs

The presence of such queue and APIs to operate on them are
ubiquitous:
- Hermes: `Runtime::drainJobs`
- V8: `MicrotaskQueue::PerformCheckpoint`
- JSC: `VM::drainMicrotasks`
- QuickJS: `JS_ExecutePendingJob`

The only exception is ChakraCore, which requires hosts to provide
the queue and set up the `JsSetPromiseContinuationCallback`,
but a JSI implementation can provide that queue trivially.

### Extra note on ECMA-262

ECMA-262 changed the spec at Mar 2020 from "asking an ECMAScript
implementation to maintain a Job Queue" to "Ask the embedder to
define its event loop, including the job queue" so technically:
- the internal approach is closer to the old spec.
- the ChakraCore approach is closer to the current spec.

Reviewed By: mhorowitz

Differential Revision: D27727920

fbshipit-source-id: b839b959facbc009f7d14b781e9287c46ea64373
2021-04-23 02:43:06 -07:00
Héctor Ramos ae07c53d0b Resolve "fatal: not a git repository" error outside of git repositories
Summary:
CocoaPods will display a "fatal: not a git repository" when these podspecs are consumed within Facebook's internal Mercurial repository due to the reliance on `git` to obtain the current commit hash.

In these cases, the podspec is being consumed locally and the commit hash is unnecessary.

The error is removed by avoiding the use of `git` if the current working directory is not a git repository (or any of the parent directories).

Changelog:
[Internal] [iOS] - Remove CocoaPods error within Facebook's repository

Reviewed By: fkgozali

Differential Revision: D27750974

fbshipit-source-id: 99159611c580baf5526f116948c5ff60e1c02e5c
2021-04-15 13:30:31 -07:00
Samuel Susla 9ef995a14a Enable C++ 17 in React Native
Summary:
Changelog: [Internal] enable support for C++ 17.

C++ 17 in React Native targets.

Short and comprehensive list of C++ features:
https://github.com/AnthonyCalandra/modern-cpp-features#c17-language-features

Reviewed By: JoshuaGross

Differential Revision: D27431145

fbshipit-source-id: e8da6fe9d70e9b7343a8caec21cdbeb043478575
2021-04-01 04:50:59 -07:00
Riley Dulin a9bae13d07 Add sampling heap profiler APIs to JSI
Summary:
The sampling heap profiler will need to be enable-able by the
inspector, and the previous snapshot/profiling APIs are all
defined on `jsi::instrumentation`.

Follow their lead and define the new sampling heap profiler APIs on
`jsi::instrumentation` as well, and implement it for Hermes.

Changelog: [Internal]

Reviewed By: neildhar

Differential Revision: D26835152

fbshipit-source-id: 4625be3214297489e04a4ceea8a22622d14299c4
2021-03-18 10:40:41 -07:00
Daniel Andersson 42fa4a6a4e Fix incorrect comment about strictEquals
Summary:
The documentation of jsi::Value::strictEquals was confusing it with SameValue (which differs in treatment of signed zeroes and NaN). Fix it by referring to the correct part of the spec.

Changelog:
[Internal][Fixed] - Fix incorrect comment

Reviewed By: avp

Differential Revision: D26430216

fbshipit-source-id: 0ea4208fbdda40c87f8028231ddefb2323b6eb96
2021-03-10 15:33:31 -08:00
Riley Dulin 4db1b3e8cd Change JSI compiler options to be private
Summary:
JSI had its compiler options like `-Wno-non-virtual-dtor` exported to targets
that depended on the JSI library.
These flags should be private to the compiler invocation on the `jsi.cpp` translation
unit and don't need to be shared with any libraries pulling in `jsi.h`.

Fixes #448

Changelog:
[Internal] - Don't export C++ warnings from JSI CMake files

Reviewed By: Huxpro

Differential Revision: D26212636

fbshipit-source-id: bd95580f89694189975a49660c439e4e5f7c5afc
2021-02-03 10:42:59 -08:00
Haochen Li 201c107338 fix typo (#30777)
Summary:
fix typo in comments

## Changelog
fix typo in comments
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[CATEGORY] [TYPE] - Message

Pull Request resolved: https://github.com/facebook/react-native/pull/30777

Reviewed By: RSNara

Differential Revision: D26108277

Pulled By: PeteTheHeat

fbshipit-source-id: 616c89263c9320bd914b26c1b814eadf316cf6d8
2021-01-27 15:59:29 -08:00
Peter Argany a1d626739d Delete iOS10/tvOS10 support from React Native Libraries
Summary:
allow-large-files

Changelog: [iOS] Remove iOS10/tvOS10 suppport

Similar to D19265731 (674b591809) for iOS9.

I just ran this command:
`find . -type f -exec sed -i '' 's/{ :ios => "10.0" }/{ :ios => "11.0" }/' {} +`
and then updated pods

Reviewed By: fkgozali

Differential Revision: D25693227

fbshipit-source-id: 0073d57ecbb268c52d21962cef202316857bcbd2
2021-01-11 16:46:16 -08:00
Peter Argany 6a9525c9b0 Delete iOS9 BUCK workarounds
Summary:
Changelog: [Internal]

According to D19411886 (30491a2085), there were some deps that required a couple targets to stay at iOS9:

- `//fbobjc/Libraries/FBGraphQLQuery:FBGraphQLQuery --> //xplat/js/react-native-github:RCTCxxUtilsApple`
- `//fbobjc/Libraries/NativeTemplateKit:NativeTemplateKitJSExecutorPlugin --> //xplat/js/react-native-github/ReactCommon/jsi:JSCRuntimeApple`

These targets seem to build after this diff, so I guess they've been pushed past iOS9.

Reviewed By: fkgozali

Differential Revision: D25692640

fbshipit-source-id: 1ce94a452090032ef316a3daa79885a7c58d6eac
2021-01-11 13:00:31 -08:00
Andres Suarez 0f4f917663 Apply clang-format update fixes
Reviewed By: igorsugak

Differential Revision: D25861683

fbshipit-source-id: 616afca13ae64c76421053ce49286035e0687e36
2021-01-09 22:11:00 -08:00
Kevin Gozali 86ffbd0a27 RNTester Android: always compile Fabric files
Summary:
This commit makes both `:ReactAndroid` and `:rn-tester:android:app` always compile in Fabric codegen outputs. However, one may still enable/disable Fabric at runtime by setting `USE_FABRIC` env var (set to 1 or 0, default is 0).

Note that we can't register custom components specific to the app, yet, so only the components in react-native github repo is covered by this commit.

RNTester doesn't enable Fabric by default yet due to known UI bugs that haven't been addressed yet.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25674311

fbshipit-source-id: 8db660c959319250ebc683c84076677cf6489e94
2020-12-21 22:43:36 -08:00
Kevin Gozali 7cfc7d65f7 Codegen: Make react-native-codegen BUCK deps OSS-compatible
Summary:
Added a few FB vs OSS polyfills:
* react_native_root_target() to refer to the root FB react-native-github/ dir or repo dir in OSS
* react_native_xplat_synced_target() for anything xplat
* a few others

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D24437245

fbshipit-source-id: ee290a87a98a8e9be67b102a96f2faac2a2cb92b
2020-10-22 17:09:29 -07:00
Marc Horowitz a8c90e6af4 Make conversions between folly::dynamic and JSI non-recursive
Summary:
Changelog:
[General][Fixed] - Fix handling of very deeply nested data across the bridge

fixes facebook/hermes#339

Reviewed By: sammy-SC

Differential Revision: D24182938

fbshipit-source-id: b674283a112b98cc63f20e436c538e3789ddf6dd
2020-10-21 20:54:55 -07:00
Riley Dulin d8b0e9d9ab Add HeapProfiler.lastSeenObjectId and HeapProfiler.heapStatsUpdate to inspector
Summary:
When taking a heap timeline, Hermes wasn't showing any data until the timeline
was written to disk and then reloaded.

Turns out we were missing support for two events:
* `HeapProfiler.lastSeenObjectId`: This event reports the most recently
allocated object ID. Used to know when objects were allocated in the
timeline.
* `HeapProfiler.heapStatsUpdate`: Report how many objects and bytes
exist for a "time fragment", represented by a fragment index. Later updates
to the same index can decrease the amount of live memory, which show up
as grey spikes instead of blue spikes

Previously, we only supported these by writing out to a file, and they didn't work
with a "live" profiling view. To fix this, I changed the periodic sampling thread
to instead be a periodic flush of a sample every few allocations. The performance
impact is tucked away only when profiling is turned on, and it's very non-invasive to
the rest of the GC. The flush calls a callback with the relevant information if the
inspector is on, and the inspector sends a message back to the browser.

Changelog: [Internal] Fix for Hermes heap timeline profiling

Reviewed By: neildhar

Differential Revision: D23993363

fbshipit-source-id: 8e0b571130cbb7e839dfb009b04f584f5179085d
2020-10-10 13:26:13 -07:00
simek 2160377574 remove most of tvOS remnants from the code (#29407)
Summary:
Refs: [0.62 release](https://reactnative.dev/blog/#moving-apple-tv-to-react-native-tvos), https://github.com/facebook/react-native/issues/28706, https://github.com/facebook/react-native/issues/28743, https://github.com/facebook/react-native/issues/29018

This PR removes most of the tvOS remnants in the code. Most of the changes are related to the tvOS platform removal from `.podspec` files, tvOS specific conditionals removal (Obj-C + JS) or tvOS CI/testing pipeline related code.

In addition to the changes listed above I have removed the deprecated `Platform.isTVOS` method. I'm not sure how `Platform.isTV` method is correlated with Android TV devices support which is technically not deprecated in the core so I left this method untouched for now.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

* **[Internal] [Removed]** - remove most of tvOS remnants from the code:
  * `TVEventHandler`, `TVTouchable`, `RCTTVView`, `RCTTVRemoteHandler` and `RCTTVNavigationEventEmitter`
* **[Internal] [Removed]** - remove `TARGET_TV_OS` flag and all the usages
* **[iOS] [Removed]** - remove deprecated `Platform.isTVOS` method
* **[iOS] [Removed]** - remove deprecated and TV related props from View:
  * `isTVSelectable`, `hasTVPreferredFocus` and `tvParallaxProperties`
* **[iOS] [Removed]** - remove `BackHandler` utility implementation

Pull Request resolved: https://github.com/facebook/react-native/pull/29407

Test Plan: Local tests (and iOS CI run) do not yield any errors, but I'm not sure how the CI pipeline would react to those changes. That is the reason why this PR is being posted as Draft. Some tweaks and code adjustment could be required.

Reviewed By: PeteTheHeat

Differential Revision: D22619441

Pulled By: shergin

fbshipit-source-id: 9aaf3840c5e8bd469c2cfcfa7c5b441ef71b30b6
2020-09-28 21:26:41 -07:00
grabbou 311d4e9ef0 feat: enable bitcode (#365)
Summary:
Bitcode is turned on by default in React Native and so, setting it here as well.

Changelog: [iOS] [Changed] - Upgraded JSI with a new HERMES_ENABLE_BITCODE flag

Pull Request resolved: https://github.com/facebook/hermes/pull/365

Reviewed By: tmikov

Differential Revision: D23823228

Pulled By: Huxpro

fbshipit-source-id: d43638818a733f6a87b2f4a1ecadad8ea9c7a419
2020-09-22 14:42:23 -07:00
Riley Dulin 22804a6144 Add cause to jsi::instrumentation::collectGarbage
Summary:
Continuing the adding of a "cause" field for logging to GCs.
This allows embedders of Hermes (such as React Native) to specify
the cause of a call to `collectGarbage`.

Notably, this allows Hermes to know when a GC is triggered by a memory warning.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D23742099

fbshipit-source-id: 99453e632328c00045b92a72f789d41c898dc518
2020-09-18 10:36:19 -07:00
empyrical 300df59c77 Android: Ensure RN_FABRIC_ENABLED is defined when building with Fabric (#29939)
Summary:
This pull request tweaks the build script for `jsiruntime` to ensure that `RN_FABRIC_ENABLED` is defined when building for Android with Fabric enabled, and using the JavascriptCore JS engine. Without it, the `createWeakObject` and `lockWeakObject` methods in `JSCRuntime.cpp` will throw an exception.

## Changelog

[Internal] [Changed] - Android: Ensure RN_FABRIC_ENABLED is defined when building with Fabric

Pull Request resolved: https://github.com/facebook/react-native/pull/29939

Test Plan: RNTester with JSC now builds and runs on Android with Fabric enabled.

Reviewed By: hramos

Differential Revision: D23671070

Pulled By: fkgozali

fbshipit-source-id: 27e69364a9f709615543be7c20b72b5536443cd8
2020-09-14 10:08:51 -07:00
Eloy Durán 941bc0ec19 Upstream RN macOS Hermes integration bits (#29748)
Summary:
Microsoft’s RN for macOS fork supports the Hermes engine nowadays https://github.com/microsoft/react-native-macos/pull/473. As a longer term work item, we’ve started moving bits that are not invasive for iOS but _are_ a maintenance burden on us—mostly when merging—upstream. Seeing as this one is a recent addition, it seemed like a good candidate to start with.

As to the actual changes, these include:

* Sharing Android’s Hermes executor with the objc side of the codebase.
* Adding a CocoaPods subspec to build the Hermes inspector source and its dependencies (`Folly/Futures`, `libevent`).
* Adding the bits to the Xcode build phase script that creates the JS bundle for release builds to compile Hermes bytecode and source-maps…
* …coincidentally it turns out that the Xcode build phase script did _not_ by default output source-maps for iOS, which is now fixed too.

All of the Hermes bits are automatically enabled, on macOS, when providing the `hermes-engine-darwin` [npm package](https://www.npmjs.com/package/hermes-engine-darwin) and enabling the Hermes pods.

## Changelog

[General] [Added] - Upstream RN macOS Hermes integration bits

Pull Request resolved: https://github.com/facebook/react-native/pull/29748

Test Plan:
Building RNTester for iOS and Android still works as before.

To test the actual changes themselves, you’ll have to use the macOS target in RNTester in the macOS fork, or create a new application from `master`:

<img width="812" alt="Screenshot 2020-08-18 at 16 55 06" src="https://user-images.githubusercontent.com/2320/90547606-160f6480-e18c-11ea-9a98-edbbaa755800.png">

Reviewed By: TheSavior

Differential Revision: D23304618

Pulled By: fkgozali

fbshipit-source-id: 4ef0e0f60d909f3c59f9cfc87c667189df656a3b
2020-08-27 01:18:33 -07:00
Marc Horowitz 525e55f898 Look up HostObject computed properties on the right object in the prototype chain.
Summary:
The change in the hermes repository fixes the security vulnerability
CVE-2020-1911.  This vulnerability only affects applications which
allow evaluation of uncontrolled, untrusted JavaScript code not
shipped with the app, so React Native apps will generally not be affected.

This revision includes a test for the bug.  The test is generic JSI
code, so it is included in the hermes and react-native repositories.

Changelog: [Internal]

Reviewed By: tmikov

Differential Revision: D23322992 (0dee0e6036)

fbshipit-source-id: 4e88c974afe1ad33a263f9cac03e9dc98d33649a
2020-08-26 11:30:34 -07:00
Martin Sherburn 549563e8ab Allow Hermes to be built as a DLL on Windows
Summary:
On windows it is required to explicitly specify what symbols need to be exported from a DLL to make them accessible (using `__declspec(dllexport)`). I have added and expanded on existing macros to do this and added exports that were previously missing.

Changelog:
[Internal][Changed] - Allow Hermes to be compiled to a single DLL on windows

Reviewed By: mhorowitz

Differential Revision: D23084343

fbshipit-source-id: 832cb17b9e637e4c04dad479aae6c1fc190f968e
2020-08-24 06:07:19 -07:00
Eloy Durán ffa3d7f638 Build macOS framework and add CocoaPods podspec (#285)
Summary:
Supersedes https://github.com/facebook/hermes/issues/239

Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.)

* On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`.
* On Apple platforms create a debugging symbols bundle.
* Add `HERMES_ENABLE_FUZZING`, which is enabled by default.
* Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default.
* Add a CocoaPods podspec that can build from source or use a binary.

A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster.

## Framework variant (default)

```
$ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build
$ cd build && ninja install && cd ..
$ tree destroot_release/
destroot_release/
├── Library
│   └── Frameworks
│       ├── hermes.framework
│       │   ├── Headers -> Versions/Current/Headers
│       │   ├── Resources -> Versions/Current/Resources
│       │   ├── Versions
│       │   │   ├── 0
│       │   │   │   ├── Headers
│       │   │   │   │   ├── CompileJS.h
│       │   │   │   │   ├── DebuggerAPI.h
│       │   │   │   │   ├── Public
│       │   │   │   │   │   ├── Buffer.h
│       │   │   │   │   │   ├── CrashManager.h
│       │   │   │   │   │   ├── CtorConfig.h
│       │   │   │   │   │   ├── DebuggerTypes.h
│       │   │   │   │   │   ├── GCConfig.h
│       │   │   │   │   │   ├── GCTripwireContext.h
│       │   │   │   │   │   └── RuntimeConfig.h
│       │   │   │   │   ├── SynthTrace.h
│       │   │   │   │   ├── SynthTraceParser.h
│       │   │   │   │   ├── TraceInterpreter.h
│       │   │   │   │   ├── TracingRuntime.h
│       │   │   │   │   ├── hermes.h
│       │   │   │   │   └── hermes_tracing.h
│       │   │   │   ├── Resources
│       │   │   │   │   └── Info.plist
│       │   │   │   └── hermes
│       │   │   └── Current -> 0
│       │   └── hermes -> Versions/Current/hermes
│       └── hermes.framework.dSYM
│           └── Contents
│               ├── Info.plist
│               └── Resources
│                   └── DWARF
│                       └── hermes
├── bin
│   ├── hbcdump
│   ├── hdb
│   ├── hermes
│   ├── hermesc
│   └── hvm
└── include
    ├── hermes
    │   ├── CompileJS.h
    │   ├── DebuggerAPI.h
    │   ├── Public
    │   │   ├── Buffer.h
    │   │   ├── CrashManager.h
    │   │   ├── CtorConfig.h
    │   │   ├── DebuggerTypes.h
    │   │   ├── GCConfig.h
    │   │   ├── GCTripwireContext.h
    │   │   └── RuntimeConfig.h
    │   ├── SynthTrace.h
    │   ├── SynthTraceParser.h
    │   ├── TraceInterpreter.h
    │   ├── TracingRuntime.h
    │   ├── hermes.h
    │   └── hermes_tracing.h
    └── jsi
        ├── JSIDynamic.h
        ├── decorator.h
        ├── instrumentation.h
        ├── jsi-inl.h
        ├── jsi.h
        ├── jsilib.h
        └── threadsafe.h
```

# dylib variant

```
$ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build
$ cd build && ninja install && cd ..
$ tree destroot_release/
destroot_release/
├── bin
│   ├── hbcdump
│   ├── hdb
│   ├── hermes
│   ├── hermesc
│   └── hvm
├── include
│   ├── hermes
│   │   ├── CompileJS.h
│   │   ├── DebuggerAPI.h
│   │   ├── Public
│   │   │   ├── Buffer.h
│   │   │   ├── CrashManager.h
│   │   │   ├── CtorConfig.h
│   │   │   ├── DebuggerTypes.h
│   │   │   ├── GCConfig.h
│   │   │   ├── GCTripwireContext.h
│   │   │   └── RuntimeConfig.h
│   │   ├── SynthTrace.h
│   │   ├── SynthTraceParser.h
│   │   ├── TraceInterpreter.h
│   │   ├── TracingRuntime.h
│   │   ├── hermes.h
│   │   └── hermes_tracing.h
│   └── jsi
│       ├── JSIDynamic.h
│       ├── decorator.h
│       ├── instrumentation.h
│       ├── jsi-inl.h
│       ├── jsi.h
│       ├── jsilib.h
│       └── threadsafe.h
└── lib
    ├── libhermes.dylib
    └── libhermes.dylib.dSYM
        └── Contents
            ├── Info.plist
            └── Resources
                └── DWARF
                    └── libhermes.dylib
```

Pull Request resolved: https://github.com/facebook/hermes/pull/285

Reviewed By: willholen

Differential Revision: D22398354

Pulled By: mhorowitz

fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-08 17:15:09 -07:00
Ryan Tremblay 9c32140068 Enable array buffers in JSCRuntime.cpp (#28961)
Summary:
The JavaScriptCore implementation of JSI [does not currently support array buffers](https://github.com/facebook/react-native/blob/master/ReactCommon/jsi/JSCRuntime.cpp#L925-L943). The comments in the code suggest the JSC version used by React Native does not work with array buffers, but this seems to be out of date since the current version of JSC used by React Native does indeed support array buffers. This change just enables array buffers in JSCRuntime.cpp.

NOTE: See https://github.com/react-native-community/discussions-and-proposals/issues/91#issuecomment-632371219 for more background on this change.

## Changelog

[General] [Added] - Support for array buffers in the JavaScriptCore implementation of JSI
Pull Request resolved: https://github.com/facebook/react-native/pull/28961

Test Plan:
To test these changes, I just made some temporary changes to RNTester to use JSI to inject a test function into the JS runtime that reads from and writes to an array buffer, and call that function from the JS of the RNTester app (see 28152ce3f4).

For the JS side of this, specifically look at 28152ce3f4/RNTester/js/RNTesterApp.android.js (L13-L18)

For the native side of this, specifically look at 28152ce3f4/RNTester/android/app/src/main/cpp/JSITest.cpp (L22-L38)

Reviewed By: shergin

Differential Revision: D21717995

Pulled By: tmikov

fbshipit-source-id: 5788479bb33c24d01aa80fa7f509e0ff9dcefea6
2020-06-09 01:11:53 -07:00