Upgrade to Pro — share decks privately, control downloads, hide ads and more …

React Native JSI ソースコードリーディング / React Native JSI source code reading

Shoken Fujisaki
October 02, 2021
1.1k

React Native JSI ソースコードリーディング / React Native JSI source code reading

React Native Matsuri 2021で発表したスライドです。
https://reactnative-matsuri.com/ja

Shoken Fujisaki

October 02, 2021
Tweet

Transcript

  1. ࣗݾ঺հ w 4IPLFO'VKJTBLJ !TIPLFOY  w גࣜձࣾΩονϋΠΫ 
 ڞಉ૑ۀऀ$50 w

    ڞஶ3FBDU/BUJWFʹࢧ͑Β͑Δاۀ w ΩονϋΠΫΤϯδχΞνʔϜͰ 
 ݄ץ3/'FBUVSFT࿈ࡌத 
 IUUQTUFDILJUDIIJLFDPN
  2. #SJEHF $ 4IBEPX5ISFBE :PHB /BUJWF.PEVMFT 
 +BWB0CK$ +4#VOEMF 
 +BWB4DSJQU

    +4$ +40/ +40/ ඇಉظΩϡʔ 6*5ISFBE +45ISFBE /BUJWF6* 
 +BWB0CK$ 3FBSDIJUFDUVSFҎલ #SJEHF
  3. #SJEHF $ 4IBEPX5ISFBE :PHB /BUJWF.PEVMFT 
 +BWB0CK$ +4#VOEMF 
 +BWB4DSJQU

    +4$ +40/ +40/ ඇಉظΩϡʔ 6*5ISFBE +45ISFBE #SJEHF͸ҰͭͳͷͰϘτϧ ωοΫʹͳΓ΍͍͢ ඇಉظͰॲཧ͢ΔͨΊɺىಈ࣌ ʹશͯಡΈࠐΉඞཁ͕͋Δ ૄ݁߹ͳඇಉظॲཧͰྑͦ͞͏͕ͩ  τϨʔυΦϑ ඇಉظͷͨΊɺύϑΥʔϚϯε ໰୊ʹͳΔՄೳੑ /BUJWF6* 
 +BWB0CK$ ϨϯμϦϯάߋ৽ʹ#SJEHFɾ +45ISFBEͷ௨՟͕ඞཁ
  4. +4#VOEMF 
 +BWB4DSJQU +45ISFBE 3FBSDIJUFDUVSFҎ߱ /FX"SDIJUFDUVSFͱ+4* +4* +47. /BUJWF.PEVMFT 


    +BWB0CK$ 6*5ISFBE /BUJWF6* 
 +BWB0CK$ $ +40/͕ͳ͘ͳͬͨ #SJEHFܦ༝ͷඇಉظॲཧ͔Β 
 ௚઀ͷಉظॲཧ΁ $ Ͱڞ௨ͷ/BUJWF.PEVMFT ͕ॻ͚ΔΑ͏ʹͳͬͨ -B[ZMPBEJOH͕Մೳʹ
  5. +4#VOEMF 
 +BWB4DSJQU +45ISFBE +4* +47. /BUJWF.PEVMFT 
 +BWB0CK$ 6*5ISFBE

    /BUJWF6* 
 +BWB0CK$ $ ͜͜·ͰಡΜͩίʔυ KTJ3VOUJNFΦϒδΣΫτ 
 +4*&YFDVUPS 
 +4*/BUJWF.PEVMFT 
 )FSNFT +4$ )FSNFT&YFDVUPS'BDUPSZ +4$&YFDVUPS'BDUPSZ 3$5+4*&YFDVUPS3VOUJNF*OTUBMMFS KTJDQQ +4*%ZOBNJDDQQ SVOUJNFHMPCBM TFU1SPQFSUZ 
 SVOUJNFHMPCBM HFU1SPQFSUZ
  6. IUUQTUFDILJUDIIJLFDPNFOUSZSFBDUOBUJWFGFBUVSFT •React NativeͷύϑΥʔϚϯεͱɺNULLจࣈΛؚΉόΠφϦจࣈྻΛॲཧͰ͖ͳ͍՝୊ •base64 ͰΤϯίʔυ͞Εͨը૾σʔλΛJS ͔ΒReact Native ϒϦοδΛհͯ͠WebView ʹ౉͢ͷ͸ ৑௕Ͱ͕͔͔࣌ؒΔ

    •C++ ͰJSI ωΠςΟϒϞδϡʔϧΛ࡞੒ͨ͠ •JSI Λ࢖༻͢Δ͜ͱʹΑΓɺJavaScript ͸C++ ϗετΦϒδΣΫτ΁ͷࢀরΛอ࣋͠ɺϝιουΛݺ ͼग़͢͜ͱ͕Ͱ͖Δɻ͜ΕʹΑΓɺઌʹड़΂ͨNULLจࣈͷ໰୊Λ࠷ऴతʹճආͰ͖ͨɻ
  7. +4#VOEMF 
 +BWB4DSJQU +45ISFBE +4* +47. /BUJWF.PEVMFT 
 +BWB0CK$ 6*5ISFBE

    /BUJWF6* 
 +BWB0CK$ $ CBTFI DQQ 
 SFBDUOBUJWFRVJDLCBTFI DQQ  2VJDL#BTFI NN ·ͱΊ KTJ3VOUJNFΦϒδΣΫτ 
 +4*&YFDVUPS 
 +4*/BUJWF.PEVMFT 
 )FSNFT +4$ )FSNFT&YFDVUPS'BDUPSZ +4$&YFDVUPS'BDUPSZ 3$5+4*&YFDVUPS3VOUJNF*OTUBMMFS KTJDQQ +4*%ZOBNJDDQQ