react-nitro-hermes 0.0.1-alpha.8 → 0.0.1-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hermes/CMakeLists.txt +874 -0
- package/hermes/android/HostObjectJniTest.cpp +178 -0
- package/hermes/android/build-logic/build.gradle.kts +31 -0
- package/hermes/android/build-logic/settings.gradle.kts +17 -0
- package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/helpers/internal/SerializeHermesCompilerPackageJson.kt +33 -0
- package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/plugins/internal/TestUtilsPlugin.kt +80 -0
- package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/tasks/internal/CustomExecTask.kt +46 -0
- package/hermes/android/build-logic/src/main/kotlin/publish.gradle.kts +82 -0
- package/hermes/android/build.gradle.kts +332 -0
- package/hermes/android/cppruntime/build.gradle +72 -0
- package/hermes/android/cppruntime/src/main/AndroidManifest.xml +2 -0
- package/hermes/android/cppruntime/src/main/cpp/CMakeLists.txt +8 -0
- package/hermes/android/cppruntime/src/main/cpp/stub.cpp +12 -0
- package/hermes/android/cross-compile/swift-libicu.patch +13 -0
- package/hermes/android/cross-compile/toolchain-android-arm-api13-gnustl.cmake +13 -0
- package/hermes/android/cross-compile/toolchain-android-arm-api15-gnustl.cmake +14 -0
- package/hermes/android/gradle/libs.versions.toml +30 -0
- package/hermes/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/hermes/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/hermes/android/gradle.properties +3 -0
- package/hermes/android/gradlew +248 -0
- package/hermes/android/gradlew.bat +93 -0
- package/hermes/android/intltest/build.gradle +147 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/CMakeLists.txt +45 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.cpp +68 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.h +44 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.java +45 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogueTestData.java +32 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesInstrumentationTest.java +150 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesIntlAndroidTest.java +147 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesIntlTest262.java +470 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesRuntimeFactory.cpp +73 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.cpp +90 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.h +62 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.java +155 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/MappedFileBuffer.cpp +48 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/MappedFileBuffer.h +36 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/OnLoad.cpp +13 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/OnLoadEpilogue.cpp +13 -0
- package/hermes/android/intltest/src/main/AndroidManifest.xml +2 -0
- package/hermes/android/ios-artifacts/build.gradle.kts +65 -0
- package/hermes/android/settings.gradle.kts +27 -0
- package/hermes/cmake/modules/Hermes.cmake +481 -0
- package/hermes/cmake/modules/Lit.cmake +96 -0
- package/hermes/doc/Branches.md +38 -0
- package/hermes/doc/BuildingAndRunning.md +121 -0
- package/hermes/doc/CodingStandards.md +112 -0
- package/hermes/doc/CrossCompilation.md +79 -0
- package/hermes/doc/Design.md +217 -0
- package/hermes/doc/Emscripten.md +156 -0
- package/hermes/doc/Features.md +143 -0
- package/hermes/doc/GCSafeCoding.md +563 -0
- package/hermes/doc/GenGC.md +300 -0
- package/hermes/doc/Hades.md +344 -0
- package/hermes/doc/HighLevelOptimizations.md +37 -0
- package/hermes/doc/IR.md +1306 -0
- package/hermes/doc/IntlAPIs.md +196 -0
- package/hermes/doc/JIT.md +999 -0
- package/hermes/doc/LazyEvalCompilation.md +84 -0
- package/hermes/doc/MemoryProfilers.md +316 -0
- package/hermes/doc/Modules.md +144 -0
- package/hermes/doc/Optimizer.md +83 -0
- package/hermes/doc/PerfProfiling.md +29 -0
- package/hermes/doc/ProhibitInvoke.md +329 -0
- package/hermes/doc/ReactNative.md +40 -0
- package/hermes/doc/ReactNativeIntegration.md +94 -0
- package/hermes/doc/RegExp.md +24 -0
- package/hermes/doc/SpecIncompat.md +85 -0
- package/hermes/doc/Strings.md +140 -0
- package/hermes/doc/TypedLanguage.md +432 -0
- package/hermes/doc/VM.md +174 -0
- package/hermes/doc/blog/2024-11-09-octane-benchmark-jit-progress.md +17 -0
- package/hermes/doc/blog/2024-12-19-static-hermes-update-dec-2024.md +47 -0
- package/hermes/doc/blog/2024-12-23-compiling-javascript-to-wasm.md +267 -0
- package/hermes/doc/blog/2025-06-09-jsi-runtime-data-apis.md +23 -0
- package/hermes/doc/blog/2025-07-15-static-h-performance-june-2025.md +18 -0
- package/hermes/doc/blog/2025-11-02-hermes-compilation-runtime-modes.md +23 -0
- package/hermes/doc/blog/2025-11-06-hermes-memory-modes.md +35 -0
- package/hermes/doc/blog/2025-11-24-json-parsing-performance.md +17 -0
- package/hermes/doc/blog/2025-12-02-iserialization.md +11 -0
- package/hermes/doc/blog/2025-12-12-new-way-to-contribute.md +68 -0
- package/hermes/doc/blog/2026-06-05-new-hermes-stable-release.md +51 -0
- package/hermes/doc/blog/README.md +25 -0
- package/hermes/doc/blog/images/2024-11-09-octane-pi3.jpeg +0 -0
- package/hermes/doc/blog/images/2024-11-09-octane-pi5.jpeg +0 -0
- package/hermes/doc/blog/images/2025-07-15-perf-hv32-interpreter.jpeg +0 -0
- package/hermes/doc/blog/images/2025-07-15-perf-hv32-jit.jpeg +0 -0
- package/hermes/doc/icu_license.txt +420 -0
- package/hermes/doc/img/heap_snapshot_retainers.png +0 -0
- package/hermes/doc/img/logo.svg +1 -0
- package/hermes/doc/img/object_captured_by_environment.png +0 -0
- package/hermes/doc/img/root_categories.png +0 -0
- package/hermes/doc/plans/ir-type/flow-type-system.md +324 -0
- package/hermes/doc/plans/ir-type/ir-type-system-v2-design.md +652 -0
- package/hermes/doc/plans/ir-type/ir-type-system.md +220 -0
- package/hermes/doc/plans/ir-type/ir-type-v2-implementation.md +1187 -0
- package/hermes/doc/plans/ir-type/memory.md +48 -0
- package/hermes/doc/plans/ir-type/phase1-steps.md +512 -0
- package/hermes/doc/plans/ir-type/progress.md +239 -0
- package/hermes/doc/plans/ir-type/typeinference-primitive-fastpath-design.md +203 -0
- package/hermes/doc/plans/ir-type/typeinference-primitive-fastpath-results.md +71 -0
- package/hermes/doc/superpowers/plans/2026-07-28-worker-arraybuffer-input.md +597 -0
- package/hermes/doc/superpowers/plans/2026-08-18-jitemitter-split.md +1149 -0
- package/hermes/doc/superpowers/plans/2026-08-20-jit-type-asserts.md +969 -0
- package/hermes/doc/superpowers/plans/2026-08-23-jit-shared-compiler-driver.md +478 -0
- package/hermes/doc/superpowers/plans/2026-08-23-x86-64-jit-skeleton.md +797 -0
- package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-arith.md +444 -0
- package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-calls.md +261 -0
- package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-props.md +240 -0
- package/hermes/doc/superpowers/plans/2026-10-26-regexp-bytecode-sharing.md +2197 -0
- package/hermes/doc/superpowers/plans/2026-10-28-regexp-start-filter-and-exec-fast-paths.md +3981 -0
- package/hermes/doc/superpowers/specs/2026-07-28-worker-arraybuffer-input-design.md +206 -0
- package/hermes/doc/superpowers/specs/2026-08-18-jitemitter-split-design.md +530 -0
- package/hermes/doc/superpowers/specs/2026-08-20-jit-type-asserts-design.md +360 -0
- package/hermes/doc/superpowers/specs/2026-08-23-x86-64-jit-design.md +246 -0
- package/hermes/doc/superpowers/specs/2026-08-26-icu-free-normalize-design.md +355 -0
- package/hermes/doc/superpowers/specs/2026-08-27-icu-free-convert-to-case-design.md +305 -0
- package/hermes/doc/superpowers/specs/2026-08-27-icu-free-locale-compare-design.md +429 -0
- package/hermes/doc/superpowers/specs/2026-08-29-icu-free-date-format-design.md +297 -0
- package/hermes/doc/superpowers/specs/2026-10-26-regexp-bytecode-sharing-design.md +605 -0
- package/hermes/doc/superpowers/specs/2026-10-28-regexp-start-filter-and-exec-fast-paths-design.md +551 -0
- package/hermes/doc/typescript-stripping.md +90 -0
- package/hermes/external/CMakeLists.txt +20 -0
- package/hermes/utils/IntlGen/IntlGen.java +531 -0
- package/hermes/utils/bench_with_stats.py +827 -0
- package/hermes/utils/build-apple-framework.sh +323 -0
- package/hermes/utils/chrome_snapshot_parser.py +210 -0
- package/hermes/utils/cmake-dev-build.sh +18 -0
- package/hermes/utils/commons.sh +55 -0
- package/hermes/utils/dump-cpp-funcs.sh +3 -0
- package/hermes/utils/es5objects.js +198 -0
- package/hermes/utils/format.sh +145 -0
- package/hermes/utils/gen-promise-internal-bc.sh +66 -0
- package/hermes/utils/genUnicodeTable.py +2503 -0
- package/hermes/utils/hermes-lit/CMakeLists.txt +22 -0
- package/hermes/utils/hermes-lit/hermes-lit.in +15 -0
- package/hermes/utils/jit/README.md +134 -0
- package/hermes/utils/jit/jit-diff.sh +160 -0
- package/hermes/utils/jit/jit-dump.sh +193 -0
- package/hermes/utils/lit-expect-gen/generate.py +217 -0
- package/hermes/utils/promise/index.js +15 -0
- package/hermes/utils/promise/package.json +13 -0
- package/hermes/utils/promise/rollup.config.js +19 -0
- package/hermes/utils/promise/yarn.lock +247 -0
- package/hermes/utils/scripts/hermes/consts.js +26 -0
- package/hermes/utils/scripts/hermes/create-tarball.js +75 -0
- package/hermes/utils/scripts/hermes/get-hermes-version.js +57 -0
- package/hermes/utils/scripts/hermes/hermes-utils.js +122 -0
- package/hermes/utils/scripts/hermes/package.json +6 -0
- package/hermes/utils/scripts/hermes/prepare-artifacts.js +113 -0
- package/hermes/utils/scripts/hermes/publish-artifacts.js +109 -0
- package/hermes/utils/scripts/hermes/publish-npm.js +96 -0
- package/hermes/utils/scripts/hermes/scm-utils.js +41 -0
- package/hermes/utils/scripts/hermes/set-artifacts-version.js +64 -0
- package/hermes/utils/scripts/hermes/version-utils.js +98 -0
- package/hermes/utils/scripts/hermes/yarn.lock +240 -0
- package/hermes/utils/summarize_sizes.py +184 -0
- package/hermes/utils/symbolicate-nativecall-stats.py +112 -0
- package/hermes/utils/test_runner.py +13 -0
- package/hermes/utils/testsuite/README.facebook +3 -0
- package/hermes/utils/testsuite/README.md +69 -0
- package/hermes/utils/testsuite/cli.py +547 -0
- package/hermes/utils/testsuite/es_ast.py +337 -0
- package/hermes/utils/testsuite/external/LICENSE +28 -0
- package/hermes/utils/testsuite/external/README.facebook +8 -0
- package/hermes/utils/testsuite/external/__init__.py +0 -0
- package/hermes/utils/testsuite/external/_monkeyYaml.py +164 -0
- package/hermes/utils/testsuite/external/parse_test262.py +141 -0
- package/hermes/utils/testsuite/hermes.py +522 -0
- package/hermes/utils/testsuite/preprocess.py +365 -0
- package/hermes/utils/testsuite/progress.py +377 -0
- package/hermes/utils/testsuite/skiplist.json +4356 -0
- package/hermes/utils/testsuite/skiplist.py +270 -0
- package/hermes/utils/testsuite/test_run_defs.py +435 -0
- package/hermes/utils/testsuite/typing_defs.py +52 -0
- package/hermes/utils/testsuite/utils.py +214 -0
- package/hermes/utils/tidy.sh +22 -0
- package/hermes/utils/update-fbcode-hermes.sh +53 -0
- package/hermes/utils/updateErrorTest.py +193 -0
- package/hermes/utils/wasm-compile.sh +65 -0
- package/package.json +1 -1
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
|
+
# yarn lockfile v1
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
ansi-regex@^5.0.1:
|
|
6
|
+
version "5.0.1"
|
|
7
|
+
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
|
8
|
+
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
|
|
9
|
+
|
|
10
|
+
ansi-styles@^4.0.0:
|
|
11
|
+
version "4.3.0"
|
|
12
|
+
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
|
|
13
|
+
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
|
|
14
|
+
dependencies:
|
|
15
|
+
color-convert "^2.0.1"
|
|
16
|
+
|
|
17
|
+
balanced-match@^1.0.0:
|
|
18
|
+
version "1.0.2"
|
|
19
|
+
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
|
|
20
|
+
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
|
|
21
|
+
|
|
22
|
+
brace-expansion@^1.1.7:
|
|
23
|
+
version "1.1.12"
|
|
24
|
+
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843"
|
|
25
|
+
integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==
|
|
26
|
+
dependencies:
|
|
27
|
+
balanced-match "^1.0.0"
|
|
28
|
+
concat-map "0.0.1"
|
|
29
|
+
|
|
30
|
+
cliui@^8.0.1:
|
|
31
|
+
version "8.0.1"
|
|
32
|
+
resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa"
|
|
33
|
+
integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==
|
|
34
|
+
dependencies:
|
|
35
|
+
string-width "^4.2.0"
|
|
36
|
+
strip-ansi "^6.0.1"
|
|
37
|
+
wrap-ansi "^7.0.0"
|
|
38
|
+
|
|
39
|
+
color-convert@^2.0.1:
|
|
40
|
+
version "2.0.1"
|
|
41
|
+
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
|
|
42
|
+
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
|
|
43
|
+
dependencies:
|
|
44
|
+
color-name "~1.1.4"
|
|
45
|
+
|
|
46
|
+
color-name@~1.1.4:
|
|
47
|
+
version "1.1.4"
|
|
48
|
+
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
|
49
|
+
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
|
50
|
+
|
|
51
|
+
concat-map@0.0.1:
|
|
52
|
+
version "0.0.1"
|
|
53
|
+
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
|
54
|
+
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
|
|
55
|
+
|
|
56
|
+
emoji-regex@^8.0.0:
|
|
57
|
+
version "8.0.0"
|
|
58
|
+
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
|
|
59
|
+
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
|
|
60
|
+
|
|
61
|
+
escalade@^3.1.1:
|
|
62
|
+
version "3.2.0"
|
|
63
|
+
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5"
|
|
64
|
+
integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==
|
|
65
|
+
|
|
66
|
+
fs.realpath@^1.0.0:
|
|
67
|
+
version "1.0.0"
|
|
68
|
+
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
|
69
|
+
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
|
|
70
|
+
|
|
71
|
+
function-bind@^1.1.2:
|
|
72
|
+
version "1.1.2"
|
|
73
|
+
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c"
|
|
74
|
+
integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==
|
|
75
|
+
|
|
76
|
+
get-caller-file@^2.0.5:
|
|
77
|
+
version "2.0.5"
|
|
78
|
+
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
|
|
79
|
+
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
|
|
80
|
+
|
|
81
|
+
glob@^7.0.0:
|
|
82
|
+
version "7.2.3"
|
|
83
|
+
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
|
|
84
|
+
integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==
|
|
85
|
+
dependencies:
|
|
86
|
+
fs.realpath "^1.0.0"
|
|
87
|
+
inflight "^1.0.4"
|
|
88
|
+
inherits "2"
|
|
89
|
+
minimatch "^3.1.1"
|
|
90
|
+
once "^1.3.0"
|
|
91
|
+
path-is-absolute "^1.0.0"
|
|
92
|
+
|
|
93
|
+
hasown@^2.0.2:
|
|
94
|
+
version "2.0.2"
|
|
95
|
+
resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003"
|
|
96
|
+
integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==
|
|
97
|
+
dependencies:
|
|
98
|
+
function-bind "^1.1.2"
|
|
99
|
+
|
|
100
|
+
inflight@^1.0.4:
|
|
101
|
+
version "1.0.6"
|
|
102
|
+
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
|
103
|
+
integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==
|
|
104
|
+
dependencies:
|
|
105
|
+
once "^1.3.0"
|
|
106
|
+
wrappy "1"
|
|
107
|
+
|
|
108
|
+
inherits@2:
|
|
109
|
+
version "2.0.4"
|
|
110
|
+
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
|
|
111
|
+
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
|
|
112
|
+
|
|
113
|
+
interpret@^1.0.0:
|
|
114
|
+
version "1.4.0"
|
|
115
|
+
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e"
|
|
116
|
+
integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==
|
|
117
|
+
|
|
118
|
+
is-core-module@^2.16.0:
|
|
119
|
+
version "2.16.1"
|
|
120
|
+
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4"
|
|
121
|
+
integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==
|
|
122
|
+
dependencies:
|
|
123
|
+
hasown "^2.0.2"
|
|
124
|
+
|
|
125
|
+
is-fullwidth-code-point@^3.0.0:
|
|
126
|
+
version "3.0.0"
|
|
127
|
+
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
|
|
128
|
+
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
|
|
129
|
+
|
|
130
|
+
minimatch@^3.1.1:
|
|
131
|
+
version "3.1.2"
|
|
132
|
+
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
|
|
133
|
+
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
|
|
134
|
+
dependencies:
|
|
135
|
+
brace-expansion "^1.1.7"
|
|
136
|
+
|
|
137
|
+
once@^1.3.0:
|
|
138
|
+
version "1.4.0"
|
|
139
|
+
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
|
140
|
+
integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==
|
|
141
|
+
dependencies:
|
|
142
|
+
wrappy "1"
|
|
143
|
+
|
|
144
|
+
path-is-absolute@^1.0.0:
|
|
145
|
+
version "1.0.1"
|
|
146
|
+
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
|
147
|
+
integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==
|
|
148
|
+
|
|
149
|
+
path-parse@^1.0.7:
|
|
150
|
+
version "1.0.7"
|
|
151
|
+
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
|
|
152
|
+
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
|
|
153
|
+
|
|
154
|
+
rechoir@^0.6.2:
|
|
155
|
+
version "0.6.2"
|
|
156
|
+
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
|
|
157
|
+
integrity sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==
|
|
158
|
+
dependencies:
|
|
159
|
+
resolve "^1.1.6"
|
|
160
|
+
|
|
161
|
+
require-directory@^2.1.1:
|
|
162
|
+
version "2.1.1"
|
|
163
|
+
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
|
|
164
|
+
integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==
|
|
165
|
+
|
|
166
|
+
resolve@^1.1.6:
|
|
167
|
+
version "1.22.10"
|
|
168
|
+
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39"
|
|
169
|
+
integrity sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==
|
|
170
|
+
dependencies:
|
|
171
|
+
is-core-module "^2.16.0"
|
|
172
|
+
path-parse "^1.0.7"
|
|
173
|
+
supports-preserve-symlinks-flag "^1.0.0"
|
|
174
|
+
|
|
175
|
+
shelljs@^0.8.5:
|
|
176
|
+
version "0.8.5"
|
|
177
|
+
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c"
|
|
178
|
+
integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==
|
|
179
|
+
dependencies:
|
|
180
|
+
glob "^7.0.0"
|
|
181
|
+
interpret "^1.0.0"
|
|
182
|
+
rechoir "^0.6.2"
|
|
183
|
+
|
|
184
|
+
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
|
|
185
|
+
version "4.2.3"
|
|
186
|
+
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
|
187
|
+
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
|
188
|
+
dependencies:
|
|
189
|
+
emoji-regex "^8.0.0"
|
|
190
|
+
is-fullwidth-code-point "^3.0.0"
|
|
191
|
+
strip-ansi "^6.0.1"
|
|
192
|
+
|
|
193
|
+
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
|
194
|
+
version "6.0.1"
|
|
195
|
+
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
|
196
|
+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
|
197
|
+
dependencies:
|
|
198
|
+
ansi-regex "^5.0.1"
|
|
199
|
+
|
|
200
|
+
supports-preserve-symlinks-flag@^1.0.0:
|
|
201
|
+
version "1.0.0"
|
|
202
|
+
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
|
|
203
|
+
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
|
|
204
|
+
|
|
205
|
+
wrap-ansi@^7.0.0:
|
|
206
|
+
version "7.0.0"
|
|
207
|
+
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
|
|
208
|
+
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
|
|
209
|
+
dependencies:
|
|
210
|
+
ansi-styles "^4.0.0"
|
|
211
|
+
string-width "^4.1.0"
|
|
212
|
+
strip-ansi "^6.0.0"
|
|
213
|
+
|
|
214
|
+
wrappy@1:
|
|
215
|
+
version "1.0.2"
|
|
216
|
+
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
|
217
|
+
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
|
|
218
|
+
|
|
219
|
+
y18n@^5.0.5:
|
|
220
|
+
version "5.0.8"
|
|
221
|
+
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
|
|
222
|
+
integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==
|
|
223
|
+
|
|
224
|
+
yargs-parser@^21.1.1:
|
|
225
|
+
version "21.1.1"
|
|
226
|
+
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
|
|
227
|
+
integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==
|
|
228
|
+
|
|
229
|
+
yargs@^17.6.2:
|
|
230
|
+
version "17.7.2"
|
|
231
|
+
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269"
|
|
232
|
+
integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==
|
|
233
|
+
dependencies:
|
|
234
|
+
cliui "^8.0.1"
|
|
235
|
+
escalade "^3.1.1"
|
|
236
|
+
get-caller-file "^2.0.5"
|
|
237
|
+
require-directory "^2.1.1"
|
|
238
|
+
string-width "^4.2.3"
|
|
239
|
+
y18n "^5.0.5"
|
|
240
|
+
yargs-parser "^21.1.1"
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
#
|
|
4
|
+
# This source code is licensed under the MIT license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
6
|
+
|
|
7
|
+
# -*- coding: utf-8 -*-
|
|
8
|
+
|
|
9
|
+
"""Executable section size analysis.
|
|
10
|
+
|
|
11
|
+
This script analyzes the size of an executable by section.
|
|
12
|
+
The 'measure' command may be given to print size metrics about a single executable,
|
|
13
|
+
as JSON.
|
|
14
|
+
Alternatively, the 'compare' command may be given to print size differences two files,
|
|
15
|
+
which may be either an executable, or JSON output.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
19
|
+
|
|
20
|
+
import argparse
|
|
21
|
+
import json
|
|
22
|
+
import math
|
|
23
|
+
import os
|
|
24
|
+
import re
|
|
25
|
+
import subprocess
|
|
26
|
+
import sys
|
|
27
|
+
from collections import OrderedDict
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
JSON_INDENT = 2
|
|
31
|
+
METRIC_KEYS = ["filesize", "rw_data", "ro_data", "code", "bss", "symbols", "unwind"]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def metric_key_for_section_name(secname):
|
|
35
|
+
"""Returns an attribute name for the given section name, or None
|
|
36
|
+
Note that not all sections are represented.
|
|
37
|
+
"""
|
|
38
|
+
if secname in ["text", "init_array", "fini_array"]:
|
|
39
|
+
return "code"
|
|
40
|
+
elif secname in ["const", "cstring", "ustring"]:
|
|
41
|
+
return "ro_data"
|
|
42
|
+
elif secname in ["data", "thread_vars", "data.rel.ro"]:
|
|
43
|
+
return "rw_data"
|
|
44
|
+
elif secname in ["bss", "thread_bss", "tbss", "dynamic"]:
|
|
45
|
+
return "bss"
|
|
46
|
+
elif secname in [
|
|
47
|
+
"stub_helper",
|
|
48
|
+
"stubs",
|
|
49
|
+
"nl_symbol_ptr",
|
|
50
|
+
"la_symbol_ptr",
|
|
51
|
+
"gnu.hash",
|
|
52
|
+
"dynsym",
|
|
53
|
+
"dynstr",
|
|
54
|
+
"rela.dyn",
|
|
55
|
+
"rela.plt",
|
|
56
|
+
"got",
|
|
57
|
+
"got.plt",
|
|
58
|
+
]:
|
|
59
|
+
return "symbols"
|
|
60
|
+
elif secname in ["eh_frame_hdr", "eh_frame", "unwind_info"]:
|
|
61
|
+
return "unwind"
|
|
62
|
+
else:
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def measure_executable(path):
|
|
67
|
+
"""Invoke `size` and parse its output, returning a dictionary.
|
|
68
|
+
|
|
69
|
+
On Darwin, the interesting lines look like:
|
|
70
|
+
.rodata 366252 5048448
|
|
71
|
+
On Linux:
|
|
72
|
+
__const 25808 4295726400
|
|
73
|
+
"""
|
|
74
|
+
metrics = {key: 0 for key in METRIC_KEYS}
|
|
75
|
+
reg = re.compile(
|
|
76
|
+
r"""[._]+ # Leading period or underscore
|
|
77
|
+
([a-z_]+)\s+ # Section name
|
|
78
|
+
(\d+)\s+ # Section size
|
|
79
|
+
(\d+)\s* # Section address
|
|
80
|
+
""",
|
|
81
|
+
re.X,
|
|
82
|
+
)
|
|
83
|
+
text = subprocess.check_output(["size", "-A", "-d", path])
|
|
84
|
+
for line in text.split("\n"):
|
|
85
|
+
match = reg.match(line)
|
|
86
|
+
if not match:
|
|
87
|
+
continue
|
|
88
|
+
secname, secsize = match.group(1, 2)
|
|
89
|
+
key = metric_key_for_section_name(secname)
|
|
90
|
+
if key:
|
|
91
|
+
metrics[key] += int(secsize)
|
|
92
|
+
# Add __LINKEDIT on Darwin, available through size -m
|
|
93
|
+
if sys.platform == "darwin":
|
|
94
|
+
m_output = subprocess.check_output(["size", "-m", "-d", path])
|
|
95
|
+
linkedit_match = re.search(r"__LINKEDIT: (\d+)", m_output)
|
|
96
|
+
if linkedit_match:
|
|
97
|
+
metrics["symbols"] += int(linkedit_match.group(1))
|
|
98
|
+
|
|
99
|
+
# Humanize and order the resulting metrics
|
|
100
|
+
result = OrderedDict()
|
|
101
|
+
for key, size in metrics.items():
|
|
102
|
+
result[key] = human_readable_size(size)
|
|
103
|
+
result["name"] = os.path.basename(path)
|
|
104
|
+
result["sha1"] = subprocess.check_output(["openssl", "sha1", path]).split()[1]
|
|
105
|
+
result["filesize"] = human_readable_size(os.path.getsize(path))
|
|
106
|
+
return result
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def human_readable_size(size, show_sign=False):
|
|
110
|
+
"""Return a human-readable string for a given byte size.
|
|
111
|
+
If show_sign is set, write positive numbers with a leading + sign.
|
|
112
|
+
"""
|
|
113
|
+
if size == 0:
|
|
114
|
+
return "0"
|
|
115
|
+
units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
|
|
116
|
+
p = math.floor(math.log(abs(size), 2) / 10)
|
|
117
|
+
maybe_plus = "+" if size > 0 and show_sign else ""
|
|
118
|
+
amt = size / math.pow(1024, p)
|
|
119
|
+
return "%d (%s%.1f %s)" % (size, maybe_plus, amt, units[int(p)])
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def compare_metrics(before_metrics, after_metrics):
|
|
123
|
+
"""Given before and after metrics, return a dictionary describing
|
|
124
|
+
their differences."""
|
|
125
|
+
result = OrderedDict()
|
|
126
|
+
for key in METRIC_KEYS:
|
|
127
|
+
# Extract the leading byte count from the humanized string
|
|
128
|
+
before = int(before_metrics[key].split()[0])
|
|
129
|
+
after = int(after_metrics[key].split()[0])
|
|
130
|
+
result[key] = human_readable_size(after - before, show_sign=True)
|
|
131
|
+
return result
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def read_or_measure_metrics(path):
|
|
135
|
+
"""Given a path (which may be to a JSON file or an executable),
|
|
136
|
+
return the metrics.
|
|
137
|
+
"""
|
|
138
|
+
try:
|
|
139
|
+
with open(path) as path_fd:
|
|
140
|
+
return json.load(path_fd)
|
|
141
|
+
except ValueError:
|
|
142
|
+
return measure_executable(path)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def subcommand_compare(args):
|
|
146
|
+
"""Implementation of compare subcommand
|
|
147
|
+
Compares two files (JSON or executables) specified in args.FILES
|
|
148
|
+
"""
|
|
149
|
+
before_path, after_path = args.FILES
|
|
150
|
+
before_metrics = read_or_measure_metrics(before_path)
|
|
151
|
+
after_metrics = read_or_measure_metrics(after_path)
|
|
152
|
+
diffs = compare_metrics(before_metrics, after_metrics)
|
|
153
|
+
print(json.dumps(diffs, indent=JSON_INDENT))
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def subcommand_measure(args):
|
|
157
|
+
"""Implementation of measure subcommand
|
|
158
|
+
Collects metrics about the files specified in args.FILES
|
|
159
|
+
"""
|
|
160
|
+
for argfile in args.FILES:
|
|
161
|
+
metrics = measure_executable(argfile)
|
|
162
|
+
print(json.dumps(metrics, indent=JSON_INDENT))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
USAGE = r"""summarize_sizes.py measure FILE [FILE...]
|
|
166
|
+
summarize_sizes.py compare BEFORE_FILE AFTER_FILE
|
|
167
|
+
|
|
168
|
+
In its first form, output a JSON description of metrics of the given file.
|
|
169
|
+
|
|
170
|
+
In its second form, output a JSON description of the differences of the two
|
|
171
|
+
files (which may be JSON descriptions from previous runs, or executables).
|
|
172
|
+
"""
|
|
173
|
+
|
|
174
|
+
if __name__ == "__main__":
|
|
175
|
+
parser = argparse.ArgumentParser(usage=USAGE)
|
|
176
|
+
subparsers = parser.add_subparsers()
|
|
177
|
+
measure_parser = subparsers.add_parser("measure")
|
|
178
|
+
measure_parser.add_argument("FILES", nargs="+")
|
|
179
|
+
measure_parser.set_defaults(func=subcommand_measure)
|
|
180
|
+
compare_parser = subparsers.add_parser("compare")
|
|
181
|
+
compare_parser.add_argument("FILES", nargs=2)
|
|
182
|
+
compare_parser.set_defaults(func=subcommand_compare)
|
|
183
|
+
pargs = parser.parse_args()
|
|
184
|
+
pargs.func(pargs)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
#
|
|
4
|
+
# This source code is licensed under the MIT license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
6
|
+
|
|
7
|
+
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
8
|
+
|
|
9
|
+
import subprocess
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
objdump = "/usr/bin/objdump"
|
|
14
|
+
symbolizer = ""
|
|
15
|
+
hermes = ""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def loadNativeCallStats():
|
|
19
|
+
"""
|
|
20
|
+
Parse the native stats dumped by Hermes from stdin. Return a tuple of
|
|
21
|
+
(data_rows, name_of_base_function)
|
|
22
|
+
"""
|
|
23
|
+
rows = []
|
|
24
|
+
baseOffsetLinePrefix = "Native call base offset "
|
|
25
|
+
baseName = ""
|
|
26
|
+
for l in sys.stdin:
|
|
27
|
+
if l.startswith(baseOffsetLinePrefix):
|
|
28
|
+
baseName = l.rstrip()[len(baseOffsetLinePrefix) :]
|
|
29
|
+
# print("found base name (%s)" % baseOffsetName)
|
|
30
|
+
continue
|
|
31
|
+
|
|
32
|
+
toks = l.split()
|
|
33
|
+
if (len(toks) != 5) or (toks[4] != "NativeCall"):
|
|
34
|
+
continue
|
|
35
|
+
rows.append(toks)
|
|
36
|
+
|
|
37
|
+
if not baseName:
|
|
38
|
+
print("Could not extract base offset function")
|
|
39
|
+
exit(1)
|
|
40
|
+
return (rows, baseName)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def findOffset(name):
|
|
44
|
+
"""Find the offset of the specified mangled function name"""
|
|
45
|
+
s = subprocess.Popen([objdump, "-t", hermes], stdout=subprocess.PIPE)
|
|
46
|
+
|
|
47
|
+
offset = 0
|
|
48
|
+
for l in s.stdout:
|
|
49
|
+
if l.find(name) != -1:
|
|
50
|
+
offset = int(l.split()[0], 16)
|
|
51
|
+
|
|
52
|
+
s.wait()
|
|
53
|
+
|
|
54
|
+
if not offset:
|
|
55
|
+
print("Could not find offset of function %s in %s" % (name, hermes))
|
|
56
|
+
exit(1)
|
|
57
|
+
|
|
58
|
+
return offset
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def symbolicate(rows, baseOffset):
|
|
62
|
+
"""Symbolicate and print the updated table, which is modified inplace"""
|
|
63
|
+
s = subprocess.Popen(
|
|
64
|
+
[symbolizer, "--obj=" + hermes], stdout=subprocess.PIPE, stdin=subprocess.PIPE
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
for toks in rows:
|
|
68
|
+
addr = int(toks[3], 16)
|
|
69
|
+
s.stdin.write(hex(addr + baseOffset) + "\n")
|
|
70
|
+
|
|
71
|
+
s.stdin.close()
|
|
72
|
+
|
|
73
|
+
index = 0
|
|
74
|
+
skipCnt = 0
|
|
75
|
+
for l in s.stdout:
|
|
76
|
+
# The symbolizer outputs three lines per function. We only care about the
|
|
77
|
+
# first line.
|
|
78
|
+
skipCnt += 1
|
|
79
|
+
if (skipCnt % 3) != 1:
|
|
80
|
+
continue
|
|
81
|
+
toks = rows[index]
|
|
82
|
+
rows[index] = (toks[0], toks[1], toks[2], l.rstrip())
|
|
83
|
+
index += 1
|
|
84
|
+
|
|
85
|
+
s.wait()
|
|
86
|
+
|
|
87
|
+
print("Count Total Per-call Function")
|
|
88
|
+
print("====== ======== ======== ============")
|
|
89
|
+
for tok in rows:
|
|
90
|
+
print("%6s %8s %8s %s" % (tok[0], tok[1], tok[2], tok[3]))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def main(argv):
|
|
94
|
+
global symbolizer, hermes, objdump
|
|
95
|
+
if len(argv) < 3 or len(argv) > 4:
|
|
96
|
+
print(
|
|
97
|
+
"Syntax: %s path-to-llvm-symbolizer path-to-hermes [path-to-objdump]"
|
|
98
|
+
% argv[0]
|
|
99
|
+
)
|
|
100
|
+
exit(1)
|
|
101
|
+
|
|
102
|
+
symbolizer = argv[1]
|
|
103
|
+
hermes = argv[2]
|
|
104
|
+
if len(argv) == 4:
|
|
105
|
+
objdump = argv[3]
|
|
106
|
+
|
|
107
|
+
rows, baseOffsetName = loadNativeCallStats()
|
|
108
|
+
baseOffset = findOffset(baseOffsetName)
|
|
109
|
+
symbolicate(rows, baseOffset)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
main(sys.argv)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env fbpython
|
|
2
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
#
|
|
4
|
+
# This source code is licensed under the MIT license found in the
|
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
|
6
|
+
|
|
7
|
+
import asyncio
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
from testsuite.cli import main
|
|
11
|
+
|
|
12
|
+
if __name__ == "__main__":
|
|
13
|
+
sys.exit(asyncio.run(main()))
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Hermes Test Runner
|
|
2
|
+
|
|
3
|
+
## How to run
|
|
4
|
+
|
|
5
|
+
The runner requires two paths:
|
|
6
|
+
1. Path to the test suite directory that we support (i.e., test262, mjsunit,
|
|
7
|
+
esprima, flow and a CVE testsuite). This can be
|
|
8
|
+
a list separated by whitespace, so you can run multiple test suites at once.
|
|
9
|
+
2. Path to the directory of Hermes binaries, including `hermes` (and`shermes`
|
|
10
|
+
depending on extra flags).
|
|
11
|
+
|
|
12
|
+
Example usage:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
# ./build is the cmake build directory.
|
|
16
|
+
|
|
17
|
+
# flow
|
|
18
|
+
./utils/test_runner.py external/flowtest/test/flow -b ./build/bin
|
|
19
|
+
|
|
20
|
+
# esprima
|
|
21
|
+
.utils/test_runner.py external/esprima/test_fixtures -b ./build/bin
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Use `--compile-args` and `--vm-args` if you want to apply extra compliler or VM
|
|
25
|
+
flags to run the testsuite. By default, we use the below flags for test262 and
|
|
26
|
+
the CVE testsuite:
|
|
27
|
+
```sh
|
|
28
|
+
# For hermes compiler
|
|
29
|
+
-test262 -fno-static-builtins -Xes6-block-scoping -Xenable-tdz
|
|
30
|
+
# For hermes VM (running the bytecode)
|
|
31
|
+
-Xes6-proxy -Xhermes-internal-test-methods -Xmicrotask-queue
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Since esprima testsuite includes only AST tests, we simply use `-dump-ast`. For
|
|
35
|
+
flow testsuite, we use additionally below flags:
|
|
36
|
+
```sh
|
|
37
|
+
-parse-flow -Xparse-component-syntax -parse-jsx -Xinclude-empty-ast-nodes -Xparse-flow-match
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Skiplist
|
|
41
|
+
|
|
42
|
+
`skiplist.json` is a config file that contains a list of tests that we want to
|
|
43
|
+
skip by default. It has several sections:
|
|
44
|
+
- "manual_skip_list": This is managed manually. We usually put tests that we plan
|
|
45
|
+
to support soon here and remove them manually once it's supported.
|
|
46
|
+
- "skip_list": We put all tests that currently fail due to spec incompliance or
|
|
47
|
+
unsupported feature here.
|
|
48
|
+
- "lazy_skip_list": Tests we want to skip when "--lazy" is passed.
|
|
49
|
+
- "permanent_skip_list": Tests we do not plan to fix or support.
|
|
50
|
+
- "handlesan_skip_list": Tests that should be run with "-gc-sanitize-handles=0".
|
|
51
|
+
- "unsupported_features": Tests with unsupported features in test262. We may
|
|
52
|
+
support them in the future.
|
|
53
|
+
- "permanent_unsupported_features": Tests with unsupported features in 262. We
|
|
54
|
+
don't have a plan to support them.
|
|
55
|
+
- "intl_tests": Tests requires INTL to be enabled.
|
|
56
|
+
- "platform_skip_list": Tests that need to be skipped depending on platforms.
|
|
57
|
+
|
|
58
|
+
Run with flag `--test-skiplist` to force running tests that are included in the
|
|
59
|
+
`skiplist.json` config (all other sections, and "lazy_skip_list" if `--lazy` is
|
|
60
|
+
given, "intl_tests" if `--test-intl` is given).
|
|
61
|
+
|
|
62
|
+
After it finishes, all passed tests included in the skiplist config file will be
|
|
63
|
+
printed, and you can tell the runner to remove these tests from the config by
|
|
64
|
+
following the prompt (we will only update "skip_list" and "permanent_skip_list"
|
|
65
|
+
section for now). Note that if some tests are covered by a folder path in the
|
|
66
|
+
config, the test runner will first find all tests under that folder, exclude
|
|
67
|
+
those passed, and insert the rest into the config file. If you don't want this
|
|
68
|
+
behavior for a specific folder, please add it to the manual list with a comment
|
|
69
|
+
explaining the reason.
|