Giter Site home page Giter Site logo

v8-jsi's Introduction

React Native V8 JSI adapter

A V8 adapter implemention of the JSI interface for the react-native framework.

Build Status

Building

Windows

Initial Windows Build Setup
  1. Download and Install
    Windows 10 Windows SDK:
    https://developer.microsoft.com/en-us/windows/downloads/sdk-archive
    Note: Windows SDK has to be Windows 10 version, NOT Windows 11
  2. Download and Install
    Microsoft Visual C++ Redistributable x64
    Microsoft Visual C++ Redistributable x86
    https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist
  3. Download and Install
    Visual Studio 2022
    https://visualstudio.microsoft.com/vs
    In Visual Studio Setup, Select the following Individual Components:
    • MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)
    • C++ ATL for latest v143 build tools with Spectre Mitigations (x86 & x64)
  4. Enable PowerShell script execution
    Launch Cmd as Administrator
    powershell Set-ExecutionPolicy RemoteSigned
  5. Perform Initial Build
    Launch Cmd as Standard user, NOT Administrator
    From V8-Jsi Repo directory:
    powershell ./localbuild.ps1
    
Windows Build

To build Win32 X64 Debug:

Launch Cmd as Standard user, NOT Administrator
From V8-Jsi Repo Directory:

powershell ./localbuild.ps1 -NoSetup

To build the specific platform and flavor, use appropriate build flags:

powershell ./localbuild.ps1 -NoSetup -Platform x86 -Configuration Release 
[EXPERIMENTAL!] Building with WSL2 on Windows 10/11
  • Enable Windows Subsystem for Linux
  • Install debian: wsl --install -d Debian
  • Install PowerShell in the Debian VM
  • Install minimal dependencies on the Debian VM: sudo apt install lsb-release
  • Make sure you have at least 15Gb of disk space on the drive where the WSL image lives (usually C:)
  • Build with pwsh ./localbuild.ps1 -AppPlatform android
  • If setup is completed succesfully, build incrementally with pwsh ./localbuild.ps1 -AppPlatform android -NoSetup
[EXPERIMENTAL!] Building on macOS
  • Install PowerShell by running brew install --cask powershell
  • Build with pwsh ./localbuild.ps1 -AppPlatform mac
  • If setup is completed succesfully, build incrementally with pwsh ./localbuild.ps1 -AppPlatform mac -NoSetup
  • Note: there are several test failures on macOS currently

Out-of-sync issues

Until the JSI headers find a more suitable home, they're currently duplicated between the various repos. Code in jsi\jsi should be synchronized with the matching version of JSI from react-native (from https://github.com/facebook/hermes/tree/master/API/jsi/jsi).

Build script patches

To regenerate after manual fix-ups, run:

  • git diff --output=..\..\..\scripts\patch\build.diff --ignore-cr-at-eol from \build\v8\build\.
  • git diff --output=..\..\scripts\patch\src.diff --ignore-cr-at-eol from \build\v8\.
  • git diff --output=..\..\..\..\scripts\patch\zlib.diff --ignore-cr-at-eol from \build\v8\third_party\zlib\.

Contributing

See Contributing guidelines for how to setup your fork of the repo and start a PR to contribute to React Native V8 JSI adapter.

License

The V8 JSI adapter, and all newly contributed code is provided under the MIT License. Portions of the JSI interface derived from Hermes are copyright Facebook.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

v8-jsi's People

Contributors

aeulitz avatar chrisfromwork avatar dannyvv avatar hansenyy avatar junielkatarn avatar mganandraj avatar microsoft-github-operations[bot] avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar nikoari avatar rasaha91 avatar rgerd avatar shivenmian avatar tatianakapos avatar tudorms avatar vmoroz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

v8-jsi's Issues

Usability of this repo on Android?

How usable is this adapter on the Android platform (eg compared to https://github.com/Kudo/react-native-v8)?
I see that you have inspector support, which sounds hugely useful for debugging/profiling React Native on Android phones.

I'm somewhat confused as the intended target of this project. Is this about Android x86(_64)? Is this targeting Win32?
The build system seems to require a Windows host and the emitted artifacts are DLLs, so I'm guessing the target isn't Android, yet there are plenty of references to Android.

Can you elaborate on this?

Clean up build script

The PowerShell build scripts include a few TODOs that require follow up:

  • clang-cl DEBUG build iterator issue
  • patch in DepotTools (tool_wrapper.py) to remove after chromium issue is addressed
  • patch in v8 template-utils.h for MSVC build (to submit upstream to Google)

Ensure source links work

Replacing VSO:5259293 in an effort to create bugs that are more specific and further upstream.

Among the things that VSO:5259293 asked for was for V8 source code to resolve in the debugger. As I understand it, we attempted to address this by the addition of source links (scripts\fetch_code.ps1). However, as per a quick check with a devinstalled Office (
lkg/main/dev 16.0.16012.15010 (b7ab2e58b0)), symbols get loaded ...

0:106> lmDvmv8jsi
Browse full module list
start end module name
00007ffad7f30000 00007ffada104000 v8jsi (private pdb symbols) c:\symbols\v8jsi.dll.pdb\130A78201C1243A0B45DA03F4F31012D1\v8jsi.dll.pdb
Loaded symbol image file: C:\Program Files\Microsoft Office\root\Office16\v8jsi.dll

However, sources do not appear to get resolved (using v8runtime::V8Runtime::ExecuteString as an example, WinDbg does not open any source file):

0:093> bl
0 e Disable Clear 00007ffad7f82a10 [D:\a\_work\1\s\build\v8build\v8\jsi\V8JsiRuntime.cpp @ 710] 0001 (0001) 0:**** v8jsi!v8runtime::V8Runtime::ExecuteString 0:093> g ... Breakpoint 0 hit v8jsi!v8runtime::V8Runtime::ExecuteString: 00007ffad7f82a10 4c894c2420 mov qword ptr [rsp+20h],r9 ss:000000f0`c6dc

JSError stack includes the message

Per V8's documentation, the Error.stack property will include the message as well, but JSI tracks "message" and "stack" as separate properties.

We need to find a way to strip the message out of the "stack" in JSError.

createWeakObject unsupported

Any plans to support create / lock of weak objects in the V8JsiRuntime? If not, what is your suggest work-around for those cases?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.