├── .ado
├── guardian
│ └── sdl
│ │ └── .gdnbaselines
├── windows-build.yml
├── windows-ci.yml
├── windows-jobs.yml
├── windows-pr.yml
└── windows-release.yml
├── .clang-format
├── .editorconfig
├── .github
└── policies
│ └── resourceManagement.yml
├── .gitignore
├── CODEOWNERS
├── LICENSE
├── LICENSE.jsi.md
├── LICENSE.napi.md
├── LICENSE.v8.md
├── README.md
├── ReactNative.V8Jsi.Windows.nuspec
├── ReactNative.V8Jsi.Windows.targets
├── config.json
├── docs
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
└── SECURITY.md
├── localbuild.ps1
├── scripts
├── build.ps1
├── download_depottools.ps1
├── fetch_code.ps1
├── patch
│ ├── build.diff
│ ├── src.diff
│ └── zlib.diff
├── tracing
│ └── trace.ps1
└── update_version.ps1
└── src
├── BUILD.gn
├── IsolateData.h
├── MurmurHash.cpp
├── MurmurHash.h
├── V8Instrumentation.cpp
├── V8Instrumentation.h
├── V8JsiRuntime.cpp
├── V8JsiRuntime_impl.h
├── V8Windows.h
├── etw
├── tracing.cpp
├── tracing.h
└── tracing.man
├── inspector
├── LICENSE_LLHTTP
├── LICENSE_NODE
├── inspector_agent.cpp
├── inspector_agent.h
├── inspector_socket.cpp
├── inspector_socket.h
├── inspector_socket_server.cpp
├── inspector_socket_server.h
├── inspector_tcp.cpp
├── inspector_tcp.h
├── inspector_utils.cpp
├── inspector_utils.h
├── llhttp.c
├── llhttp.h
├── llhttp_api.c
└── llhttp_http.c
├── jsi
├── .clang-format
├── CMakeLists.txt
├── JSIDynamic.cpp
├── JSIDynamic.h
├── README.md
├── decorator.h
├── instrumentation.h
├── jsi-inl.h
├── jsi.cpp
├── jsi.h
├── jsilib-posix.cpp
├── jsilib-windows.cpp
├── jsilib.h
├── test
│ ├── testlib.cpp
│ ├── testlib.h
│ └── testlib_ext.cpp
└── threadsafe.h
├── makev8jsi.lst
├── node-api-jsi
├── ApiLoaders
│ ├── JSRuntimeApi.cpp
│ ├── JSRuntimeApi.h
│ ├── JSRuntimeApi.inc
│ ├── NodeApi.cpp
│ ├── NodeApi.h
│ ├── NodeApi.inc
│ ├── NodeApi_posix.cpp
│ ├── NodeApi_win.cpp
│ ├── V8Api.cpp
│ ├── V8Api.h
│ └── V8Api.inc
├── NodeApiJsiRuntime.cpp
└── NodeApiJsiRuntime.h
├── node-api
├── .clang-format
├── Readme.md
├── env-inl.h
├── js_native_api.h
├── js_native_api_types.h
├── js_native_api_v8.cc
├── js_native_api_v8.h
├── js_native_api_v8_internals.h
├── js_runtime_api.h
├── test
│ ├── BUILD.gn
│ ├── child_process.cpp
│ ├── child_process.h
│ ├── js-native-api
│ │ ├── .gitignore
│ │ ├── 2_function_arguments
│ │ │ ├── 2_function_arguments.c
│ │ │ ├── binding.gyp
│ │ │ └── test.js
│ │ ├── 3_callbacks
│ │ │ ├── 3_callbacks.c
│ │ │ ├── binding.gyp
│ │ │ └── test.js
│ │ ├── 4_object_factory
│ │ │ ├── 4_object_factory.c
│ │ │ ├── binding.gyp
│ │ │ └── test.js
│ │ ├── 5_function_factory
│ │ │ ├── 5_function_factory.c
│ │ │ ├── binding.gyp
│ │ │ └── test.js
│ │ ├── 6_object_wrap
│ │ │ ├── 6_object_wrap.cc
│ │ │ ├── binding.gyp
│ │ │ ├── myobject.h
│ │ │ ├── test-object-wrap-ref.js
│ │ │ └── test.js
│ │ ├── 7_factory_wrap
│ │ │ ├── 7_factory_wrap.cc
│ │ │ ├── binding.gyp
│ │ │ ├── myobject.cc
│ │ │ ├── myobject.h
│ │ │ └── test.js
│ │ ├── 8_passing_wrapped
│ │ │ ├── 8_passing_wrapped.cc
│ │ │ ├── binding.gyp
│ │ │ ├── myobject.cc
│ │ │ ├── myobject.h
│ │ │ └── test.js
│ │ ├── common-inl.h
│ │ ├── common.h
│ │ ├── common
│ │ │ ├── assert.js
│ │ │ └── common.js
│ │ ├── entry_point.h
│ │ ├── node_api.h
│ │ ├── node_api_types.h
│ │ ├── test_array
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_array.c
│ │ ├── test_bigint
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_bigint.c
│ │ ├── test_cannot_run_js
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_cannot_run_js.c
│ │ ├── test_constructor
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ ├── test2.js
│ │ │ ├── test_constructor.c
│ │ │ ├── test_null.c
│ │ │ ├── test_null.h
│ │ │ └── test_null.js
│ │ ├── test_conversions
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ ├── test_conversions.c
│ │ │ ├── test_null.c
│ │ │ └── test_null.h
│ │ ├── test_dataview
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_dataview.c
│ │ ├── test_date
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_date.c
│ │ ├── test_error
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_error.c
│ │ ├── test_exception
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ ├── testFinalizerException.js
│ │ │ └── test_exception.c
│ │ ├── test_finalizer
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ ├── test_fatal_finalize.js
│ │ │ └── test_finalizer.c
│ │ ├── test_function
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_function.c
│ │ ├── test_general
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ ├── testEnvCleanup.js
│ │ │ ├── testFinalizer.js
│ │ │ ├── testGlobals.js
│ │ │ ├── testInstanceOf.js
│ │ │ ├── testNapiRun.js
│ │ │ ├── testNapiStatus.js
│ │ │ └── test_general.c
│ │ ├── test_handle_scope
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_handle_scope.c
│ │ ├── test_instance_data
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_instance_data.c
│ │ ├── test_new_target
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_new_target.c
│ │ ├── test_number
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ ├── test_null.c
│ │ │ ├── test_null.h
│ │ │ ├── test_null.js
│ │ │ └── test_number.c
│ │ ├── test_object
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ ├── test_exceptions.c
│ │ │ ├── test_exceptions.js
│ │ │ ├── test_null.c
│ │ │ ├── test_null.h
│ │ │ ├── test_null.js
│ │ │ └── test_object.c
│ │ ├── test_promise
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_promise.c
│ │ ├── test_properties
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_properties.c
│ │ ├── test_reference
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ ├── test_finalizer.c
│ │ │ ├── test_finalizer.js
│ │ │ └── test_reference.c
│ │ ├── test_reference_double_free
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ ├── test_reference_double_free.c
│ │ │ └── test_wrap.js
│ │ ├── test_string
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ ├── test_null.c
│ │ │ ├── test_null.h
│ │ │ ├── test_null.js
│ │ │ └── test_string.c
│ │ ├── test_symbol
│ │ │ ├── binding.gyp
│ │ │ ├── test1.js
│ │ │ ├── test2.js
│ │ │ ├── test3.js
│ │ │ └── test_symbol.c
│ │ └── test_typedarray
│ │ │ ├── binding.gyp
│ │ │ ├── test.js
│ │ │ └── test_typedarray.c
│ ├── node_api_test.cpp
│ ├── node_api_test.h
│ ├── node_api_test_v8.cpp
│ └── testmain.cpp
├── util-inl.h
└── v8_api.cpp
├── public
├── Readme.md
├── ScriptStore.h
├── V8JsiRuntime.h
├── compat.h
└── v8_api.h
├── source_link.json
├── testmain.cpp
└── version.rc
/.ado/guardian/sdl/.gdnbaselines:
--------------------------------------------------------------------------------
1 | {
2 | "hydrated": false,
3 | "properties": {
4 | "helpUri": "https://eng.ms/docs/microsoft-security/security/azure-security/cloudai-security-fundamentals-engineering/security-integration/guardian-wiki/microsoft-guardian/general/baselines",
5 | "hydrationStatus": "This file does not contain identifying data. It is safe to check into your repo. To hydrate this file with identifying data, run `guardian hydrate --help` and follow the guidance."
6 | },
7 | "version": "1.0.0",
8 | "baselines": {
9 | "guardian-baseline": {
10 | "name": "guardian-baseline",
11 | "createdDate": "2023-10-21 02:08:05Z",
12 | "lastUpdatedDate": "2023-10-21 02:08:05Z"
13 | }
14 | },
15 | "results": {
16 | "0c9bea3e0ba4ec1f9f412df1d9116cda3781b5f120c9c268bb38c53a60873a6b": {
17 | "signature": "0c9bea3e0ba4ec1f9f412df1d9116cda3781b5f120c9c268bb38c53a60873a6b",
18 | "alternativeSignatures": [
19 | "d388e5517024dc10e219f9ca342f0884e28b46aae2e92b5537e52fe93e7440c4"
20 | ],
21 | "memberOf": [
22 | "guardian-baseline"
23 | ],
24 | "createdDate": "2023-10-21 02:08:05Z"
25 | },
26 | "844ac8bd279863c0714bef8a8d5458a853e1d7d0afcd6f8fb042c895af9b9c99": {
27 | "signature": "844ac8bd279863c0714bef8a8d5458a853e1d7d0afcd6f8fb042c895af9b9c99",
28 | "alternativeSignatures": [
29 | "de276c1956f6cad7acc9765c7a1127a126d525b45cf9f6a7ce277a47997a7fdc"
30 | ],
31 | "memberOf": [
32 | "guardian-baseline"
33 | ],
34 | "createdDate": "2023-10-21 02:08:05Z"
35 | },
36 | "2133282a9767561d4a3199f40d102d50c276a40c713ff51873b15b4ccc2528e2": {
37 | "signature": "2133282a9767561d4a3199f40d102d50c276a40c713ff51873b15b4ccc2528e2",
38 | "alternativeSignatures": [
39 | "ceb49633d687c3be368840b3302478e053bb885169e33ae4584c212ef0ca96ae"
40 | ],
41 | "memberOf": [
42 | "guardian-baseline"
43 | ],
44 | "createdDate": "2023-10-21 02:08:05Z"
45 | },
46 | "a635e094fa0297b9c8c002484e334ecce0e66ec494a15ccf740ff74c74820e9b": {
47 | "signature": "a635e094fa0297b9c8c002484e334ecce0e66ec494a15ccf740ff74c74820e9b",
48 | "alternativeSignatures": [
49 | "b83062005ae1d65bfaa76c66029ecb5b21395b435db7e98f0a50f2bb9ad8725a"
50 | ],
51 | "memberOf": [
52 | "guardian-baseline"
53 | ],
54 | "createdDate": "2023-10-21 02:08:05Z"
55 | },
56 | "ed3f0398be556ba4a84a6b2e4d664c79f345adfb13f6a6a284ed7cd341b28dc5": {
57 | "signature": "ed3f0398be556ba4a84a6b2e4d664c79f345adfb13f6a6a284ed7cd341b28dc5",
58 | "alternativeSignatures": [
59 | "920e5ba1bfb73b3cdd3865260c2aa6d1d541b45f2811d8e7a83ef65f9346dc68"
60 | ],
61 | "memberOf": [
62 | "guardian-baseline"
63 | ],
64 | "createdDate": "2023-10-21 02:08:05Z"
65 | },
66 | "8601ac212ffa5688ac5bd7c90c88c6821801db1c12aaa238bf8f0b5ddb997cb8": {
67 | "signature": "8601ac212ffa5688ac5bd7c90c88c6821801db1c12aaa238bf8f0b5ddb997cb8",
68 | "alternativeSignatures": [
69 | "e2056c1150375f38dc46635a15a0ed40c3c626ff43e433d5c16f03b72d22934e"
70 | ],
71 | "memberOf": [
72 | "guardian-baseline"
73 | ],
74 | "createdDate": "2023-10-21 02:08:05Z"
75 | }
76 | }
77 | }
--------------------------------------------------------------------------------
/.ado/windows-ci.yml:
--------------------------------------------------------------------------------
1 | name: v8jsi_ci_0.0.$(Date:yyMM.d)$(Rev:rrr)
2 |
3 | # The triggers are overridden by the ADO pipeline definitions.
4 | trigger: none
5 | pr: none
6 |
7 | variables:
8 | - group: V8-Jsi Secrets
9 | - name: ArtifactServices.Symbol.AccountName
10 | value: microsoft
11 | - name: ArtifactServices.Symbol.PAT
12 | value: $(pat-symbols-publish-microsoft)
13 | - name: tags
14 | value: production,externalfacing
15 |
16 | extends:
17 | template: windows-jobs.yml@self
18 | parameters:
19 | # CI builds must pass true.
20 | isPublish: true
21 | # It must be false for real builds. Use true only for the build pipeline debugging.
22 | fakeBuild: false
--------------------------------------------------------------------------------
/.ado/windows-pr.yml:
--------------------------------------------------------------------------------
1 | name: v8jsi_pr_0.0.$(Date:yyMM.d)$(Rev:rrr)
2 |
3 | trigger: none
4 | pr:
5 | - master
6 | - "*-stable"
7 |
8 | extends:
9 | template: windows-jobs.yml@self
10 | parameters:
11 | # PR builds must pass false.
12 | isPublish: false
13 | # It must be false for real builds. Use true only for the build pipeline debugging.
14 | fakeBuild: false
15 |
--------------------------------------------------------------------------------
/.ado/windows-release.yml:
--------------------------------------------------------------------------------
1 | #
2 | # The v8-jsi Release pipeline entry point.
3 | # It releases NuGet packages to the public ms/react-native ADO feed and to the Office feed.
4 | #
5 |
6 | name: v8jsi_release_0.0.$(Date:yyMM.d)$(Rev:rrr)
7 |
8 | # The triggers are overridden by the ADO pipeline definitions.
9 | trigger: none
10 | pr: none
11 |
12 | resources:
13 | pipelines:
14 | - pipeline: microsoft.v8-jsi.ci
15 | project: ISS
16 | source: microsoft.v8-jsi.ci
17 | trigger:
18 | branches:
19 | include:
20 | - master
21 | - main
22 | - '*-stable'
23 |
24 | repositories:
25 | - repository: CustomPipelineTemplates
26 | type: git
27 | name: 1ESPipelineTemplates/OfficePipelineTemplates
28 | ref: refs/tags/release
29 |
30 | extends:
31 | template: v1/Office.Official.PipelineTemplate.yml@CustomPipelineTemplates
32 | parameters:
33 | pool:
34 | name: Azure-Pipelines-1ESPT-ExDShared
35 | vmImage: windows-latest
36 | os: windows
37 |
38 | stages:
39 | - stage: publish_nugets
40 | displayName: Publish V8Jsi NuGets
41 |
42 | jobs:
43 | - job: ms_react_native_nuget_job
44 | displayName: Publish Nuget to ms/react-native
45 | condition: succeeded()
46 | timeoutInMinutes: 0
47 |
48 | templateContext:
49 | inputs:
50 | - input: pipelineArtifact
51 | pipeline: microsoft.v8-jsi.ci
52 | artifactName: published-packages
53 | targetPath: $(Pipeline.Workspace)\published-packages
54 |
55 | steps:
56 | - script: dir /S $(Pipeline.Workspace)\published-packages
57 | displayName: Show directory contents
58 |
59 | - script: dotnet nuget list source
60 | displayName: Show Nuget sources
61 |
62 | # TODO: Fix the NuGet name after the service connection approval
63 | - task: 1ES.PublishNuGet@1
64 | displayName: NuGet push
65 | inputs:
66 | useDotNetTask: true
67 | packageParentPath: '$(Pipeline.Workspace)/published-packages'
68 | packagesToPush: '$(Pipeline.Workspace)/published-packages/ReactNative.V8Jsi.Windows.*.nupkg'
69 | nuGetFeedType: external
70 | publishFeedCredentials: 'Nuget - ms/react-native-public'
71 | externalEndpoint: 'Nuget - ms/react-native-public'
72 | publishPackageMetadata: true
73 |
74 | - job: office_nuget_job
75 | displayName: Publish Nuget to office
76 | condition: succeeded()
77 | timeoutInMinutes: 0
78 |
79 | templateContext:
80 | inputs:
81 | - input: pipelineArtifact
82 | pipeline: microsoft.v8-jsi.ci
83 | artifactName: published-packages
84 | targetPath: $(Pipeline.Workspace)\published-packages
85 |
86 | steps:
87 | - script: dir /S $(Pipeline.Workspace)\published-packages
88 | displayName: Show directory contents
89 |
90 | - script: dotnet nuget list source
91 | displayName: Show Nuget sources
92 |
93 | # TODO: Fix the NuGet name after the service connection approval
94 | - task: 1ES.PublishNuGet@1
95 | displayName: NuGet push
96 | inputs:
97 | useDotNetTask: true
98 | packageParentPath: '$(Pipeline.Workspace)/published-packages'
99 | packagesToPush: '$(Pipeline.Workspace)/published-packages/ReactNative.V8Jsi.Windows.*.nupkg'
100 | nuGetFeedType: external
101 | publishFeedCredentials: 'ES365-Office-Nuget-Package-Publisher'
102 | externalEndpoint: 'ES365-Office-Nuget-Package-Publisher'
103 | publishPackageMetadata: true
104 |
--------------------------------------------------------------------------------
/.clang-format:
--------------------------------------------------------------------------------
1 | ---
2 | AccessModifierOffset: -1
3 | AlignAfterOpenBracket: AlwaysBreak
4 | AlignConsecutiveAssignments: false
5 | AlignConsecutiveDeclarations: false
6 | AlignEscapedNewlinesLeft: true
7 | AlignOperands: false
8 | AlignTrailingComments: false
9 | AllowAllParametersOfDeclarationOnNextLine: false
10 | AllowShortBlocksOnASingleLine: false
11 | AllowShortCaseLabelsOnASingleLine: false
12 | AllowShortFunctionsOnASingleLine: Empty
13 | AllowShortIfStatementsOnASingleLine: false
14 | AllowShortLoopsOnASingleLine: false
15 | AlwaysBreakAfterReturnType: None
16 | AlwaysBreakBeforeMultilineStrings: true
17 | AlwaysBreakTemplateDeclarations: true
18 | BinPackArguments: false
19 | BinPackParameters: false
20 | BraceWrapping:
21 | AfterClass: false
22 | AfterControlStatement: false
23 | AfterEnum: false
24 | AfterFunction: false
25 | AfterNamespace: false
26 | AfterObjCDeclaration: false
27 | AfterStruct: false
28 | AfterUnion: false
29 | BeforeCatch: false
30 | BeforeElse: false
31 | IndentBraces: false
32 | BreakBeforeBinaryOperators: None
33 | BreakBeforeBraces: Attach
34 | BreakBeforeTernaryOperators: true
35 | BreakConstructorInitializersBeforeComma: false
36 | BreakAfterJavaFieldAnnotations: false
37 | BreakStringLiterals: false
38 | ColumnLimit: 120
39 | CommentPragmas: '^ IWYU pragma:'
40 | ConstructorInitializerAllOnOneLineOrOnePerLine: true
41 | ConstructorInitializerIndentWidth: 4
42 | ContinuationIndentWidth: 4
43 | Cpp11BracedListStyle: true
44 | DerivePointerAlignment: false
45 | DisableFormat: false
46 | ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ]
47 | IncludeBlocks: Preserve
48 | IncludeCategories:
49 | - Regex: 'pch.h'
50 | Priority: -1
51 | - Regex: '.*\.g\..*'
52 | Priority: 1
53 | - Regex: '^<.*\.h(pp)?>'
54 | Priority: 2
55 | - Regex: '^<.*'
56 | Priority: 3
57 | - Regex: '.*'
58 | Priority: 4
59 | IndentCaseLabels: true
60 | IndentWidth: 2
61 | IndentWrappedFunctionNames: false
62 | KeepEmptyLinesAtTheStartOfBlocks: false
63 | MacroBlockBegin: ''
64 | MacroBlockEnd: ''
65 | MaxEmptyLinesToKeep: 1
66 | NamespaceIndentation: None
67 | ObjCBlockIndentWidth: 2
68 | ObjCSpaceAfterProperty: true
69 | ObjCSpaceBeforeProtocolList: true
70 | PenaltyBreakBeforeFirstCallParameter: 1
71 | PenaltyBreakComment: 300
72 | PenaltyBreakFirstLessLess: 120
73 | PenaltyBreakString: 1000
74 | PenaltyExcessCharacter: 1000000
75 | PenaltyReturnTypeOnItsOwnLine: 200
76 | PointerAlignment: Right
77 | ReflowComments: true
78 | SortIncludes: true
79 | SpaceAfterCStyleCast: false
80 | SpaceBeforeAssignmentOperators: true
81 | SpaceBeforeParens: ControlStatements
82 | SpaceInEmptyParentheses: false
83 | SpacesBeforeTrailingComments: 1
84 | SpacesInAngles: false
85 | SpacesInContainerLiterals: true
86 | SpacesInCStyleCastParentheses: false
87 | SpacesInParentheses: false
88 | SpacesInSquareBrackets: false
89 | Standard: Cpp11
90 | TabWidth: 8
91 | UseTab: Never
92 | ...
93 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig is awesome: http://EditorConfig.org
2 |
3 | # top-most EditorConfig file
4 | root = false
5 |
6 | [*]
7 | indent_style = space
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 | charset = utf-8
11 | end_of_line = lf
12 | indent_size = 2
13 |
14 |
15 | # Xml project files
16 | [*.{config,csproj,nuspec,props,targets,vcxitems,vcxproj,vcxproj.filters}]
17 | end_of_line = crlf
18 | insert_final_newline = false
19 |
20 | [*.ps1]
21 | indent_style = tab
22 | indent_size = 4
23 |
24 | [package.json]
25 | insert_final_newline = false
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | .vscode
3 | build.log
4 | src/version_gen.rc
5 | src/source_link_gen.json
6 |
7 | # outputs
8 | out
9 | *.nupkg
10 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # Global Catch-All
2 | * @microsoft/jshost
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | React Native V8 JSI adapter
2 |
3 | Copyright (c) Microsoft Corporation.
4 |
5 | MIT License
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in all
15 | copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | SOFTWARE.
--------------------------------------------------------------------------------
/LICENSE.jsi.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Facebook, Inc. and its affiliates.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/LICENSE.v8.md:
--------------------------------------------------------------------------------
1 | This license applies to all parts of V8 that are not externally
2 | maintained libraries. The externally maintained libraries used by V8
3 | are:
4 |
5 | - PCRE test suite, located in
6 | test/mjsunit/third_party/regexp-pcre/regexp-pcre.js. This is based on the
7 | test suite from PCRE-7.3, which is copyrighted by the University
8 | of Cambridge and Google, Inc. The copyright notice and license
9 | are embedded in regexp-pcre.js.
10 |
11 | - Layout tests, located in test/mjsunit/third_party/object-keys. These are
12 | based on layout tests from webkit.org which are copyrighted by
13 | Apple Computer, Inc. and released under a 3-clause BSD license.
14 |
15 | - Strongtalk assembler, the basis of the files assembler-arm-inl.h,
16 | assembler-arm.cc, assembler-arm.h, assembler-ia32-inl.h,
17 | assembler-ia32.cc, assembler-ia32.h, assembler-x64-inl.h,
18 | assembler-x64.cc, assembler-x64.h, assembler-mips-inl.h,
19 | assembler-mips.cc, assembler-mips.h, assembler.cc and assembler.h.
20 | This code is copyrighted by Sun Microsystems Inc. and released
21 | under a 3-clause BSD license.
22 |
23 | - Valgrind client API header, located at src/third_party/valgrind/valgrind.h
24 | This is released under the BSD license.
25 |
26 | - The Wasm C/C++ API headers, located at third_party/wasm-api/wasm.{h,hh}
27 | This is released under the Apache license. The API's upstream prototype
28 | implementation also formed the basis of V8's implementation in
29 | src/wasm/c-api.cc.
30 |
31 | These libraries have their own licenses; we recommend you read them,
32 | as their terms may differ from the terms below.
33 |
34 | Further license information can be found in LICENSE files located in
35 | sub-directories.
36 |
37 | Copyright 2014, the V8 project authors. All rights reserved.
38 | Redistribution and use in source and binary forms, with or without
39 | modification, are permitted provided that the following conditions are
40 | met:
41 |
42 | * Redistributions of source code must retain the above copyright
43 | notice, this list of conditions and the following disclaimer.
44 | * Redistributions in binary form must reproduce the above
45 | copyright notice, this list of conditions and the following
46 | disclaimer in the documentation and/or other materials provided
47 | with the distribution.
48 | * Neither the name of Google Inc. nor the names of its
49 | contributors may be used to endorse or promote products derived
50 | from this software without specific prior written permission.
51 |
52 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
54 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
55 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
56 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
57 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
58 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
62 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/ReactNative.V8Jsi.Windows.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ReactNative.V8Jsi.Windows
5 | $Version$
6 |
7 | Contains a Windows implementation of the V8 JSI wrapper for ReactNative ($VersionDetails$)
8 | Facebook, Google, Microsoft
9 | https://github.com/microsoft/v8-jsi
10 | false
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/ReactNative.V8Jsi.Windows.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 | $(Platform)
4 |
5 | x86
6 |
7 |
8 |
9 | $(MSBuildThisFileDirectory)..\..\lib\win32\$(Configuration)\$(V8Platform);%(AdditionalLibraryDirectories)
10 | v8jsi.dll.lib;%(AdditionalDependencies)
11 | v8jsi.dll;%(DelayLoadDLLs)
12 |
13 |
14 | $(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories)
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.79.1",
3 | "v8ref": "refs/branch-heads/12.1",
4 | "buildNumber": "285"
5 | }
6 |
--------------------------------------------------------------------------------
/docs/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Microsoft Open Source Code of Conduct
2 |
3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4 |
5 | Resources:
6 |
7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
10 |
--------------------------------------------------------------------------------
/docs/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | This project welcomes contributions and suggestions. Most contributions require you to agree to a
4 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
5 | the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
6 |
7 | When you submit a pull request, a CLA bot will automatically determine whether you need to provide
8 | a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
9 | provided by the bot. You will only need to do this once across all repos using our CLA.
10 |
11 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
12 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
13 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
--------------------------------------------------------------------------------
/docs/SECURITY.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Security
4 |
5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
6 |
7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)) of a security vulnerability, please report it to us as described below.
8 |
9 | ## Reporting Security Issues
10 |
11 | **Please do not report security vulnerabilities through public GitHub issues.**
12 |
13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
14 |
15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
16 |
17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
18 |
19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20 |
21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22 | * Full paths of source file(s) related to the manifestation of the issue
23 | * The location of the affected source code (tag/branch/commit or direct URL)
24 | * Any special configuration required to reproduce the issue
25 | * Step-by-step instructions to reproduce the issue
26 | * Proof-of-concept or exploit code (if possible)
27 | * Impact of the issue, including how an attacker might exploit the issue
28 |
29 | This information will help us triage your report more quickly.
30 |
31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
32 |
33 | ## Preferred Languages
34 |
35 | We prefer all communications to be in English.
36 |
37 | ## Policy
38 |
39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
40 |
41 |
42 |
--------------------------------------------------------------------------------
/localbuild.ps1:
--------------------------------------------------------------------------------
1 | # Copyright (c) Microsoft Corporation.
2 | # Licensed under the MIT license.
3 | param(
4 | [System.IO.DirectoryInfo]$SourcesPath = $PSScriptRoot,
5 |
6 | [System.IO.DirectoryInfo]$OutputPath = "$PSScriptRoot\out",
7 |
8 | [ValidateSet('x64', 'x86', 'arm64')]
9 | [String[]]$Platform = @('x64'),
10 |
11 | [ValidateSet('Debug', 'Release')]
12 | [String[]]$Configuration = @('Debug'),
13 |
14 | [ValidateSet('win32', 'android', 'linux', 'mac')]
15 | [String[]]$AppPlatform = @('win32'),
16 |
17 | [switch]$NoSetup,
18 |
19 | [switch]$FakeBuild
20 | )
21 |
22 | if (!$NoSetup -and !$FakeBuild) {
23 | Write-Host "Downloading environment..."
24 | & ".\scripts\download_depottools.ps1" -SourcesPath $SourcesPath -NoADO
25 |
26 | if (!$?) {
27 | Write-Host "Failed to download depot-tools"
28 | exit 1
29 | }
30 |
31 | Write-Host "Fetching code..."
32 | & ".\scripts\fetch_code.ps1" -SourcesPath $SourcesPath -AppPlatform $AppPlatform[0]
33 |
34 | if (!$?) {
35 | Write-Host "Failed to retrieve the v8 code"
36 | exit 1
37 | }
38 | } else {
39 | & ".\scripts\download_depottools.ps1" -SourcesPath $SourcesPath -NoSetup -NoADO
40 | }
41 |
42 | foreach ($Plat in $Platform) {
43 | foreach ($Config in $Configuration) {
44 | foreach ($AppPlat in $AppPlatform) {
45 | Write-Host "Building $AppPlat $Plat $Config..."
46 | & ".\scripts\build.ps1" -SourcesPath $SourcesPath -OutputPath $OutputPath `
47 | -Platform $Plat -Configuration $Config -AppPlatform $AppPlat -FakeBuild:$FakeBuild
48 | }
49 | }
50 | }
51 |
52 | if (!$?) {
53 | Write-Host "Build failure"
54 | Pop-Location
55 | exit 1
56 | }
57 |
--------------------------------------------------------------------------------
/scripts/download_depottools.ps1:
--------------------------------------------------------------------------------
1 | # Copyright (c) Microsoft Corporation.
2 | # Licensed under the MIT license.
3 | param(
4 | [System.IO.DirectoryInfo]$SourcesPath = $PSScriptRoot,
5 | [switch]$NoSetup,
6 | [switch]$NoADO
7 | )
8 |
9 | $ASIO_VERSION = "1-22-1"
10 |
11 | $workpath = Join-Path $SourcesPath "build"
12 |
13 | if (!(Test-Path -Path $workpath)) {
14 | New-Item -ItemType "directory" -Path $workpath | Out-Null
15 | }
16 |
17 | if (! $NoSetup) {
18 | Write-Host "Downloading depot-tools.zip..."
19 |
20 | # This is the recommended way to get depot-tools on Windows, but the git checkout is much faster (shaves off about 5 minutes from CI loop runtime)
21 | $UseArchive = $false
22 |
23 | if ($UseArchive) {
24 | $output = [System.IO.Path]::GetTempFileName()
25 | Invoke-WebRequest -Uri "https://storage.googleapis.com/chrome-infra/depot_tools.zip" -OutFile "$output.zip"
26 | Write-Host "Unzipping depot-tools.zip..."
27 | Expand-Archive -path "$output.zip" -DestinationPath "$workpath\depot_tools"
28 | Remove-Item "$output.zip"
29 | }
30 | else {
31 | $env:GIT_REDIRECT_STDERR = '2>&1'
32 | Push-Location $workpath
33 | git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
34 | Pop-Location
35 | }
36 |
37 | # Download dependencies (ASIO used by Inspector implementation)
38 | $asioUrl ="https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-$ASIO_VERSION.zip"
39 | $asioDownload = Join-Path $workpath $(Split-Path -Path $asioUrl -Leaf)
40 |
41 | Invoke-WebRequest -Uri $asioUrl -OutFile $asioDownload
42 | $asioDownload | Expand-Archive -DestinationPath $workpath -Force
43 | }
44 |
45 | Write-Host "Modifying PATH..."
46 |
47 | $depot_tools_path = Join-Path $workpath "depot_tools"
48 |
49 | if (!$PSVersionTable.Platform -or $IsWindows) {
50 | $path = "$depot_tools_path;$Env:PATH"
51 | $path = ($path.Split(';') | Where-Object { $_ -notlike '*Chocolatey*' }) -join ';'
52 | }
53 | else {
54 | $path = "$depot_tools_path`:$Env:PATH"
55 | }
56 |
57 | $env:PATH = $path
58 | $env:DEPOT_TOOLS_WIN_TOOLCHAIN = 0
59 | $env:GCLIENT_PY3 = 1
60 | $env:ASIO_ROOT = Join-Path $workpath "asio-asio-$ASIO_VERSION\asio\include"
61 |
62 | if (! $NoADO) {
63 | Write-Host "##vso[task.setvariable variable=PATH;]$path"
64 | Write-Host "##vso[task.setvariable variable=DEPOT_TOOLS_WIN_TOOLCHAIN;]0"
65 | Write-Host "##vso[task.setvariable variable=GCLIENT_PY3;]1"
66 | Write-Host "##vso[task.setvariable variable=ASIO_ROOT;]$env:ASIO_ROOT"
67 | }
--------------------------------------------------------------------------------
/scripts/patch/build.diff:
--------------------------------------------------------------------------------
1 | diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn
2 | index de1cd6efc..ed87ccb75 100644
3 | --- a/config/compiler/BUILD.gn
4 | +++ b/config/compiler/BUILD.gn
5 | @@ -1758,7 +1758,7 @@ config("default_warnings") {
6 | # TODO(thakis): Remove this once
7 | # https://swiftshader-review.googlesource.com/c/SwiftShader/+/57968 has
8 | # rolled into angle.
9 | - cflags += [ "/wd4244" ]
10 | + # cflags += [ "/wd4244" ]
11 | }
12 | } else {
13 | if (is_apple && !is_nacl) {
14 | @@ -2045,7 +2045,7 @@ config("no_chromium_code") {
15 | }
16 | cflags += [
17 | "/wd4800", # Disable warning when forcing value to bool.
18 | - "/wd4267", # TODO(jschuh): size_t to int.
19 | + # "/wd4267", # TODO(jschuh): size_t to int.
20 | ]
21 | } else {
22 | if (is_clang && !is_nacl) {
23 | diff --git a/config/win/BUILD.gn b/config/win/BUILD.gn
24 | index 6e1417aa4..4079a06c8 100644
25 | --- a/config/win/BUILD.gn
26 | +++ b/config/win/BUILD.gn
27 | @@ -486,16 +486,16 @@ config("default_crt") {
28 | # Component mode: dynamic CRT. Since the library is shared, it requires
29 | # exceptions or will give errors about things not matching, so keep
30 | # exceptions on.
31 | - configs = [ ":dynamic_crt" ]
32 | + configs = [ ":dynamic_crt", ":win_msvc_cfg" ]
33 | } else {
34 | if (current_os == "winuwp") {
35 | # https://blogs.msdn.microsoft.com/vcblog/2014/06/10/the-great-c-runtime-crt-refactoring/
36 | # contains a details explanation of what is happening with the Windows
37 | # CRT in Visual Studio releases related to Windows store applications.
38 | - configs = [ ":dynamic_crt" ]
39 | + configs = [ ":dynamic_crt", ":win_msvc_cfg" ]
40 | } else {
41 | # Desktop Windows: static CRT.
42 | - configs = [ ":static_crt" ]
43 | + configs = [ ":dynamic_crt", ":win_msvc_cfg" ]
44 | }
45 | }
46 | }
47 | @@ -689,3 +689,11 @@ config("lean_and_mean") {
48 | config("nominmax") {
49 | defines = [ "NOMINMAX" ]
50 | }
51 | +
52 | +# Control Flow Guard (CFG)
53 | +config("win_msvc_cfg") {
54 | + if (!is_clang) {
55 | + cflags = [ "/guard:cf", "/Qspectre", "/W3" ]
56 | + ldflags = [ "/guard:cf" ]
57 | + }
58 | +}
59 | \ No newline at end of file
60 | diff --git a/toolchain/win/setup_toolchain.py b/toolchain/win/setup_toolchain.py
61 | index 521c24398..3677b5a2f 100644
62 | --- a/toolchain/win/setup_toolchain.py
63 | +++ b/toolchain/win/setup_toolchain.py
64 | @@ -186,6 +186,8 @@ def _LoadToolchainEnv(cpu, toolchain_root, sdk_dir, target_store):
65 | # building with a new and untested SDK. This should stay in sync with the
66 | # packaged toolchain in build/vs_toolchain.py.
67 | args.append(SDK_VERSION)
68 | + # Use Spectre runtime libraries
69 | + args.append('-vcvars_spectre_libs=spectre')
70 | variables = _LoadEnvFromBat(args)
71 | return _ExtractImportantEnvironment(variables)
72 |
73 |
--------------------------------------------------------------------------------
/scripts/patch/zlib.diff:
--------------------------------------------------------------------------------
1 | diff --git a/BUILD.gn b/BUILD.gn
2 | index 49f52e1..7ee4871 100644
3 | --- a/BUILD.gn
4 | +++ b/BUILD.gn
5 | @@ -32,7 +32,7 @@ config("zlib_internal_config") {
6 | # V8 supports building with msvc, these silence some warnings that
7 | # causes compilation to fail (https://crbug.com/1255096).
8 | cflags = [
9 | - "/wd4244",
10 | + #"/wd4244",
11 | "/wd4100",
12 | "/wd4702",
13 | "/wd4127",
14 |
--------------------------------------------------------------------------------
/scripts/update_version.ps1:
--------------------------------------------------------------------------------
1 | # Copyright (c) Microsoft Corporation.
2 | # Licensed under the MIT license.
3 | param(
4 | [System.IO.DirectoryInfo]$SourcesPath = $PSScriptRoot,
5 | [switch]$BetaBranch,
6 | [switch]$GitPush
7 | )
8 |
9 | # Details about the V8 release process: https://v8.dev/docs/release-process
10 |
11 | # TODO: a cron ADO task should trigger this script to update the version
12 |
13 | # https://omahaproxy.appspot.com is deprecated in favor of https://chromiumdash.appspot.com
14 |
15 | $channel = "Stable"
16 | if ($BetaBranch) {
17 | $channel = "Beta"
18 | }
19 |
20 | $latestVersion = (Invoke-WebRequest "https://chromiumdash.appspot.com/fetch_releases?channel=$channel&platform=Windows&num=1" -UseBasicParsing | ConvertFrom-Json).milestone / 10
21 |
22 | Write-Host "Latest $channel version is $latestVersion"
23 |
24 | $config = Get-Content (Join-Path $SourcesPath "config.json") | Out-String | ConvertFrom-Json
25 | $builtVersion = (($config.v8ref | Select-String -Pattern "refs/branch-heads/(\d+\.\d+)").Matches[0].Groups[1].Value).Trim()
26 |
27 | Write-Host "Version currently being built is $builtVersion"
28 |
29 | if ($builtVersion -eq $latestVersion) {
30 | Write-Host "Latest $channel version is already being built"
31 | } else {
32 | Write-Host "New $channel version released, manual intervention required to bump the version!"
33 | exit 1
34 | }
35 |
36 | function GetLatestBuildNumberForVersion($buildingVersion) {
37 | $versionUrl = "https://chromium.googlesource.com/v8/v8.git/+/refs/heads/$buildingVersion-lkgr/include/v8-version.h?format=text"
38 | $content = Invoke-WebRequest -ContentType 'text/plain' -Uri $versionUrl -UseBasicParsing
39 | $content = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($content.Content))
40 | $majorVersion = (($content | Select-String -Pattern "V8_MAJOR_VERSION (\d+)").Matches[0].Groups[1].Value).Trim()
41 | $minorVersion = (($content | Select-String -Pattern "V8_MINOR_VERSION (\d+)").Matches[0].Groups[1].Value).Trim()
42 | $buildNumber = (($content | Select-String -Pattern "V8_BUILD_NUMBER (\d+)").Matches[0].Groups[1].Value).Trim()
43 | $patchLevel = (($content | Select-String -Pattern "V8_PATCH_LEVEL (\d+)").Matches[0].Groups[1].Value).Trim()
44 |
45 | # TODO: do this for every new $patchLevel as well?
46 | return $buildNumber
47 | }
48 |
49 | function BumpSemVer($version) {
50 | $versionParts = $version.Split('.')
51 | $versionParts[2] = [int]$versionParts[2] + 1
52 | return $versionParts -join '.'
53 | }
54 |
55 | $buildNumber = GetLatestBuildNumberForVersion($latestVersion)
56 |
57 | Write-Host "Latest build number upstream is $buildNumber"
58 | Write-Host "Build number currently being built is $($config.buildNumber)"
59 |
60 | if ($buildNumber -eq $config.buildNumber) {
61 | Write-Host "Latest build number is already being built. All good!"
62 | exit 0
63 | }
64 |
65 | Write-Host "New $channel build number released, attempting to bump it"
66 |
67 | $config.buildNumber = $buildNumber
68 | $config.version = BumpSemVer($config.version)
69 |
70 | ConvertTo-Json -InputObject $config | Set-Content (Join-Path $SourcesPath "config.json")
71 |
72 | if (! $GitPush) {
73 | Write-Host "Git push not requested, we would be updating the version to $($config.version) (new upstream build number $buildNumber)"
74 | } else {
75 | git config user.name github-actions
76 | git config user.email github-actions@github.com
77 | git add config.json
78 | git commit -m "Updating version to $($config.version) (new upstream build number $buildNumber)"
79 | git push
80 | }
--------------------------------------------------------------------------------
/src/IsolateData.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation.
2 | // Licensed under the MIT license.
3 | #pragma once
4 |
5 | #include "v8.h"
6 |
7 | #include "public/V8JsiRuntime.h"
8 |
9 | namespace v8runtime {
10 |
11 | constexpr int ISOLATE_DATA_SLOT = 0;
12 | constexpr int ISOLATE_INSPECTOR_SLOT = 1;
13 |
14 | // Custom data associated with each V8 isolate.
15 | struct IsolateData {
16 | IsolateData(v8::Isolate *isolate, std::shared_ptr foreground_task_runner) noexcept
17 | : isolate_{isolate}, foreground_task_runner_{std::move(foreground_task_runner)} {}
18 |
19 | std::shared_ptr foreground_task_runner_;
20 |
21 | v8::Local napi_type_tag() const {
22 | return napi_type_tag_.Get(isolate_);
23 | }
24 |
25 | v8::Local napi_wrapper() const {
26 | return napi_wrapper_.Get(isolate_);
27 | }
28 |
29 | v8::Local nativeStateKey() const {
30 | return nativeStateKey_.Get(isolate_);
31 | }
32 |
33 | // Creates property names often used by the NAPI implementation.
34 | void CreateProperties() {
35 | v8::HandleScope handle_scope(isolate_);
36 | CreateProperty(napi_type_tag_, "node:napi:type_tag");
37 | CreateProperty(napi_wrapper_, "node:napi:wrapper");
38 | CreateProperty(nativeStateKey_, "v8:jsi:nativeStateKey");
39 | }
40 |
41 | private:
42 | template
43 | void CreateProperty(v8::Eternal &property, const char (&name)[N]) {
44 | property.Set(
45 | isolate_,
46 | v8::Private::New(
47 | isolate_,
48 | v8::String::NewFromOneByte(
49 | isolate_, reinterpret_cast(name), v8::NewStringType::kInternalized, N - 1)
50 | .ToLocalChecked()));
51 | }
52 |
53 | private:
54 | v8::Isolate *isolate_;
55 | v8::Eternal napi_type_tag_;
56 | v8::Eternal napi_wrapper_;
57 | v8::Eternal nativeStateKey_;
58 | };
59 |
60 | } // namespace v8runtime
61 |
--------------------------------------------------------------------------------
/src/MurmurHash.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation.
2 | // Licensed under the MIT license.
3 | #pragma once
4 |
5 | #include
6 | #include
7 |
8 | // Computes the hash of key using MurmurHash3 algorithm, the value is planced in the "hash" output parameter
9 | // The function returns whether or not key is comprised of only ASCII characters (<=127)
10 | bool murmurhash(const uint8_t *key, size_t length, uint64_t &hash);
--------------------------------------------------------------------------------
/src/V8Instrumentation.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace v8runtime {
7 |
8 | class V8Instrumentation : public facebook::jsi::Instrumentation {
9 | public:
10 | explicit V8Instrumentation(v8::Isolate *isolate);
11 |
12 | std::string getRecordedGCStats() override;
13 | std::unordered_map getHeapInfo(bool includeExpensive) override;
14 | void collectGarbage(std::string cause) override;
15 | void startTrackingHeapObjectStackTraces(
16 | std::function<
17 | void(uint64_t lastSeenObjectID, std::chrono::microseconds timestamp, std::vector stats)>
18 | fragmentCallback) override;
19 | void stopTrackingHeapObjectStackTraces() override;
20 | void startHeapSampling(size_t samplingInterval) override;
21 | void stopHeapSampling(std::ostream &os) override;
22 | #if JSI_VERSION >= 13
23 | void createSnapshotToFile(const std::string &path, const HeapSnapshotOptions &options = {false}) override;
24 | void createSnapshotToStream(std::ostream &os, const HeapSnapshotOptions &options = {false}) override;
25 | #else
26 | void createSnapshotToFile(const std::string &path) override;
27 | void createSnapshotToStream(std::ostream &os) override;
28 | #endif
29 | std::string flushAndDisableBridgeTrafficTrace() override;
30 | void writeBasicBlockProfileTraceToFile(const std::string &fileName) const override;
31 | void dumpProfilerSymbolsToFile(const std::string &fileName) const override;
32 |
33 | private:
34 | void createSnapshotToStreamImpl(std::ostream &os, bool captureNumericValue = false);
35 |
36 | private:
37 | v8::Isolate *isolate_;
38 | };
39 |
40 | } // namespace v8runtime
41 |
--------------------------------------------------------------------------------
/src/V8Windows.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation.
2 | // Licensed under the MIT license.
3 | #pragma once
4 |
5 | #ifndef SRC_V8WINDOWS_H
6 | #define SRC_V8WINDOWS_H
7 |
8 | #ifdef _WIN32
9 |
10 | #ifndef NOMINMAX
11 | #define NOMINMAX
12 | #endif // NOMINMAX
13 |
14 | #ifndef WIN32_LEAN_AND_MEAN
15 | #define WIN32_LEAN_AND_MEAN
16 | #endif // WIN32_LEAN_AND_MEAN
17 |
18 | #include
19 |
20 | #endif
21 |
22 | #include "etw/tracing.h"
23 |
24 | #endif // SRC_V8WINDOWS_H
25 |
--------------------------------------------------------------------------------
/src/etw/tracing.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation.
2 | // Licensed under the MIT license.
3 | #include "V8Windows.h"
4 | #include "tracing.h"
5 |
6 | // Define the GUID to use in TraceLoggingProviderRegister
7 | // {85A99459-1F1D-49BD-B3DC-E5EF2AD0C2C8}
8 | TRACELOGGING_DEFINE_PROVIDER(
9 | g_hV8JSIRuntimeTraceLoggingProvider,
10 | "Microsoft.V8JSIRuntime",
11 | (0x85a99459, 0x1f1d, 0x49bd, 0xb3, 0xdc, 0xe5, 0xef, 0x2a, 0xd0, 0xc2, 0xc8));
12 |
13 | // Define the GUID to use in TraceLoggingProviderRegister
14 | // {5509957C-25B6-4294-B2FA-8A8E41E6BC37}
15 | TRACELOGGING_DEFINE_PROVIDER(
16 | g_hV8JSIInspectorTraceLoggingProvider,
17 | "Microsoft.V8JSIInspector",
18 | (0x5509957c, 0x25b6, 0x4294, 0xb2, 0xfa, 0x8a, 0x8e, 0x41, 0xe6, 0xbc, 0x37));
19 |
20 | void globalInitializeTracing() {
21 | #ifdef _WIN32
22 | TraceLoggingUnregister(g_hV8JSIRuntimeTraceLoggingProvider);
23 | TraceLoggingRegister(g_hV8JSIRuntimeTraceLoggingProvider);
24 | TraceLoggingUnregister(g_hV8JSIInspectorTraceLoggingProvider);
25 | TraceLoggingRegister(g_hV8JSIInspectorTraceLoggingProvider);
26 | #endif
27 |
28 | TRACEV8RUNTIME_VERBOSE("Initializing providers.");
29 | }
30 |
--------------------------------------------------------------------------------
/src/etw/tracing.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation.
2 | // Licensed under the MIT license.
3 | #pragma once
4 |
5 | #ifdef _WIN32
6 | #include
7 | #include
8 |
9 | #ifdef __cplusplus
10 | extern "C" {
11 | #endif
12 |
13 | TRACELOGGING_DECLARE_PROVIDER(g_hV8JSIRuntimeTraceLoggingProvider);
14 | TRACELOGGING_DECLARE_PROVIDER(g_hV8JSIInspectorTraceLoggingProvider);
15 |
16 | // Ref: https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/tracelogging-examples
17 | #define TRACEV8RUNTIME_VERBOSE(eventName, ...) \
18 | TraceLoggingWrite( \
19 | g_hV8JSIRuntimeTraceLoggingProvider, eventName, TraceLoggingLevel(TRACE_LEVEL_VERBOSE), __VA_ARGS__);
20 |
21 | #define TRACEV8RUNTIME_WARNING(eventName, ...) \
22 | TraceLoggingWrite( \
23 | g_hV8JSIRuntimeTraceLoggingProvider, eventName, TraceLoggingLevel(TRACE_LEVEL_WARNING), __VA_ARGS__);
24 |
25 | #define TRACEV8RUNTIME_ERROR(eventName, ...) \
26 | TraceLoggingWrite(g_hV8JSIRuntimeTraceLoggingProvider, eventName, TraceLoggingLevel(TRACE_LEVEL_ERROR), __VA_ARGS__);
27 |
28 | #define TRACEV8RUNTIME_CRITICAL(eventName, ...) \
29 | TraceLoggingWrite( \
30 | g_hV8JSIRuntimeTraceLoggingProvider, eventName, TraceLoggingLevel(TRACE_LEVEL_CRITICAL), __VA_ARGS__);
31 |
32 | // Ref:
33 | // https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/tracelogging-examples
34 | #define TRACEV8INSPECTOR_VERBOSE(eventName, ...) \
35 | TraceLoggingWrite( \
36 | g_hV8JSIInspectorTraceLoggingProvider, eventName, TraceLoggingLevel(TRACE_LEVEL_VERBOSE), __VA_ARGS__);
37 |
38 | #define TRACEV8INSPECTOR_WARNING(eventName, ...) \
39 | TraceLoggingWrite( \
40 | g_hV8JSIInspectorTraceLoggingProvider, eventName, TraceLoggingLevel(TRACE_LEVEL_WARNING), __VA_ARGS__);
41 |
42 | #define TRACEV8INSPECTOR_ERROR(eventName, ...) \
43 | TraceLoggingWrite( \
44 | g_hV8JSIInspectorTraceLoggingProvider, eventName, TraceLoggingLevel(TRACE_LEVEL_ERROR), __VA_ARGS__);
45 |
46 | #define TRACEV8INSPECTOR_CRITICAL(eventName, ...) \
47 | TraceLoggingWrite( \
48 | g_hV8JSIInspectorTraceLoggingProvider, eventName, TraceLoggingLevel(TRACE_LEVEL_CRITICAL), __VA_ARGS__);
49 |
50 | void globalInitializeTracing();
51 |
52 | #ifdef __cplusplus
53 | } // extern "C"
54 | #endif
55 |
56 | #else // WIN32
57 |
58 | #define TRACEV8RUNTIME_VERBOSE(eventName, ...)
59 | #define TRACEV8RUNTIME_WARNING(eventName, ...)
60 | #define TRACEV8RUNTIME_CRITICAL(eventName, ...)
61 | #define TraceLoggingString(foo,bar)
62 |
63 | #endif
--------------------------------------------------------------------------------
/src/inspector/LICENSE_LLHTTP:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/v8-jsi/ac52b54efec5bf164c9d8766f7411ca394a2d6a8/src/inspector/LICENSE_LLHTTP
--------------------------------------------------------------------------------
/src/inspector/LICENSE_NODE:
--------------------------------------------------------------------------------
1 | Copyright Node.js contributors. All rights reserved.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to
5 | deal in the Software without restriction, including without limitation the
6 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 | sell copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19 | IN THE SOFTWARE.
--------------------------------------------------------------------------------
/src/inspector/inspector_agent.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation.
2 | // Licensed under the MIT license.
3 | // This code is based on the old node inspector implementation. See LICENSE_NODE for Node.js' project license details
4 | #pragma once
5 |
6 | #include
7 | #include
8 |
9 | #include
10 |
11 | namespace inspector {
12 |
13 | class AgentImpl;
14 |
15 | class Agent : public std::enable_shared_from_this {
16 | public:
17 | explicit Agent(
18 | v8::Isolate *isolate,
19 | int port);
20 | ~Agent();
21 |
22 | void waitForDebugger();
23 |
24 | void addContext(v8::Local context, const char* context_name);
25 | void removeContext(v8::Local context);
26 |
27 | void start();
28 | void stop();
29 |
30 | bool IsStarted();
31 | bool IsConnected();
32 | void WaitForDisconnect();
33 | void FatalException(
34 | v8::Local error,
35 | v8::Local message);
36 |
37 | void notifyLoadedUrl(const std::string& url);
38 | std::shared_ptr getShared();
39 |
40 | static void startAll();
41 |
42 | private:
43 | std::shared_ptr impl;
44 | static std::unordered_set> agents_s_;
45 | };
46 |
47 | } // namespace inspector
48 |
--------------------------------------------------------------------------------
/src/inspector/inspector_socket.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation.
2 | // Licensed under the MIT license.
3 | // This code is based on the old node inspector implementation. See LICENSE_NODE for Node.js' project license details
4 | #pragma once
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #include "inspector_tcp.h"
11 |
12 | namespace inspector {
13 |
14 | class ProtocolHandler;
15 |
16 | class InspectorSocket {
17 | public:
18 | InspectorSocket() = default;
19 | ~InspectorSocket();
20 |
21 | class Delegate {
22 | public:
23 | virtual void OnHttpGet(const std::string& host,
24 | const std::string& path) = 0;
25 | virtual void OnSocketUpgrade(const std::string& host,
26 | const std::string& path,
27 | const std::string& accept_key) = 0;
28 | virtual void OnWsFrame(const std::vector& frame) = 0;
29 | virtual ~Delegate() {}
30 | };
31 |
32 | static std::unique_ptr Accept(std::shared_ptr connection, std::unique_ptr&& delegate);
33 |
34 | void AcceptUpgrade(const std::string& accept_key);
35 | void CancelHandshake();
36 | void Write(const char* data, size_t len);
37 | void SwitchProtocol(std::unique_ptr&& handler);
38 | std::string GetHost();
39 |
40 | private:
41 | std::unique_ptr protocol_handler_;
42 |
43 | InspectorSocket(const InspectorSocket&) = delete;
44 | InspectorSocket& operator=(const InspectorSocket&) = delete;
45 | };
46 |
47 | } // namespace inspector
48 |
--------------------------------------------------------------------------------
/src/inspector/inspector_socket_server.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation.
2 | // Licensed under the MIT license.
3 | // This code is based on the old node inspector implementation. See LICENSE_NODE for Node.js' project license details
4 | #pragma once
5 |
6 | #include "inspector_agent.h"
7 | #include "inspector_socket.h"
8 |
9 | #include