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.
Files changed (181) hide show
  1. package/hermes/CMakeLists.txt +874 -0
  2. package/hermes/android/HostObjectJniTest.cpp +178 -0
  3. package/hermes/android/build-logic/build.gradle.kts +31 -0
  4. package/hermes/android/build-logic/settings.gradle.kts +17 -0
  5. package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/helpers/internal/SerializeHermesCompilerPackageJson.kt +33 -0
  6. package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/plugins/internal/TestUtilsPlugin.kt +80 -0
  7. package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/tasks/internal/CustomExecTask.kt +46 -0
  8. package/hermes/android/build-logic/src/main/kotlin/publish.gradle.kts +82 -0
  9. package/hermes/android/build.gradle.kts +332 -0
  10. package/hermes/android/cppruntime/build.gradle +72 -0
  11. package/hermes/android/cppruntime/src/main/AndroidManifest.xml +2 -0
  12. package/hermes/android/cppruntime/src/main/cpp/CMakeLists.txt +8 -0
  13. package/hermes/android/cppruntime/src/main/cpp/stub.cpp +12 -0
  14. package/hermes/android/cross-compile/swift-libicu.patch +13 -0
  15. package/hermes/android/cross-compile/toolchain-android-arm-api13-gnustl.cmake +13 -0
  16. package/hermes/android/cross-compile/toolchain-android-arm-api15-gnustl.cmake +14 -0
  17. package/hermes/android/gradle/libs.versions.toml +30 -0
  18. package/hermes/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  19. package/hermes/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  20. package/hermes/android/gradle.properties +3 -0
  21. package/hermes/android/gradlew +248 -0
  22. package/hermes/android/gradlew.bat +93 -0
  23. package/hermes/android/intltest/build.gradle +147 -0
  24. package/hermes/android/intltest/java/com/facebook/hermes/test/CMakeLists.txt +45 -0
  25. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.cpp +68 -0
  26. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.h +44 -0
  27. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.java +45 -0
  28. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogueTestData.java +32 -0
  29. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesInstrumentationTest.java +150 -0
  30. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesIntlAndroidTest.java +147 -0
  31. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesIntlTest262.java +470 -0
  32. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesRuntimeFactory.cpp +73 -0
  33. package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.cpp +90 -0
  34. package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.h +62 -0
  35. package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.java +155 -0
  36. package/hermes/android/intltest/java/com/facebook/hermes/test/MappedFileBuffer.cpp +48 -0
  37. package/hermes/android/intltest/java/com/facebook/hermes/test/MappedFileBuffer.h +36 -0
  38. package/hermes/android/intltest/java/com/facebook/hermes/test/OnLoad.cpp +13 -0
  39. package/hermes/android/intltest/java/com/facebook/hermes/test/OnLoadEpilogue.cpp +13 -0
  40. package/hermes/android/intltest/src/main/AndroidManifest.xml +2 -0
  41. package/hermes/android/ios-artifacts/build.gradle.kts +65 -0
  42. package/hermes/android/settings.gradle.kts +27 -0
  43. package/hermes/cmake/modules/Hermes.cmake +481 -0
  44. package/hermes/cmake/modules/Lit.cmake +96 -0
  45. package/hermes/doc/Branches.md +38 -0
  46. package/hermes/doc/BuildingAndRunning.md +121 -0
  47. package/hermes/doc/CodingStandards.md +112 -0
  48. package/hermes/doc/CrossCompilation.md +79 -0
  49. package/hermes/doc/Design.md +217 -0
  50. package/hermes/doc/Emscripten.md +156 -0
  51. package/hermes/doc/Features.md +143 -0
  52. package/hermes/doc/GCSafeCoding.md +563 -0
  53. package/hermes/doc/GenGC.md +300 -0
  54. package/hermes/doc/Hades.md +344 -0
  55. package/hermes/doc/HighLevelOptimizations.md +37 -0
  56. package/hermes/doc/IR.md +1306 -0
  57. package/hermes/doc/IntlAPIs.md +196 -0
  58. package/hermes/doc/JIT.md +999 -0
  59. package/hermes/doc/LazyEvalCompilation.md +84 -0
  60. package/hermes/doc/MemoryProfilers.md +316 -0
  61. package/hermes/doc/Modules.md +144 -0
  62. package/hermes/doc/Optimizer.md +83 -0
  63. package/hermes/doc/PerfProfiling.md +29 -0
  64. package/hermes/doc/ProhibitInvoke.md +329 -0
  65. package/hermes/doc/ReactNative.md +40 -0
  66. package/hermes/doc/ReactNativeIntegration.md +94 -0
  67. package/hermes/doc/RegExp.md +24 -0
  68. package/hermes/doc/SpecIncompat.md +85 -0
  69. package/hermes/doc/Strings.md +140 -0
  70. package/hermes/doc/TypedLanguage.md +432 -0
  71. package/hermes/doc/VM.md +174 -0
  72. package/hermes/doc/blog/2024-11-09-octane-benchmark-jit-progress.md +17 -0
  73. package/hermes/doc/blog/2024-12-19-static-hermes-update-dec-2024.md +47 -0
  74. package/hermes/doc/blog/2024-12-23-compiling-javascript-to-wasm.md +267 -0
  75. package/hermes/doc/blog/2025-06-09-jsi-runtime-data-apis.md +23 -0
  76. package/hermes/doc/blog/2025-07-15-static-h-performance-june-2025.md +18 -0
  77. package/hermes/doc/blog/2025-11-02-hermes-compilation-runtime-modes.md +23 -0
  78. package/hermes/doc/blog/2025-11-06-hermes-memory-modes.md +35 -0
  79. package/hermes/doc/blog/2025-11-24-json-parsing-performance.md +17 -0
  80. package/hermes/doc/blog/2025-12-02-iserialization.md +11 -0
  81. package/hermes/doc/blog/2025-12-12-new-way-to-contribute.md +68 -0
  82. package/hermes/doc/blog/2026-06-05-new-hermes-stable-release.md +51 -0
  83. package/hermes/doc/blog/README.md +25 -0
  84. package/hermes/doc/blog/images/2024-11-09-octane-pi3.jpeg +0 -0
  85. package/hermes/doc/blog/images/2024-11-09-octane-pi5.jpeg +0 -0
  86. package/hermes/doc/blog/images/2025-07-15-perf-hv32-interpreter.jpeg +0 -0
  87. package/hermes/doc/blog/images/2025-07-15-perf-hv32-jit.jpeg +0 -0
  88. package/hermes/doc/icu_license.txt +420 -0
  89. package/hermes/doc/img/heap_snapshot_retainers.png +0 -0
  90. package/hermes/doc/img/logo.svg +1 -0
  91. package/hermes/doc/img/object_captured_by_environment.png +0 -0
  92. package/hermes/doc/img/root_categories.png +0 -0
  93. package/hermes/doc/plans/ir-type/flow-type-system.md +324 -0
  94. package/hermes/doc/plans/ir-type/ir-type-system-v2-design.md +652 -0
  95. package/hermes/doc/plans/ir-type/ir-type-system.md +220 -0
  96. package/hermes/doc/plans/ir-type/ir-type-v2-implementation.md +1187 -0
  97. package/hermes/doc/plans/ir-type/memory.md +48 -0
  98. package/hermes/doc/plans/ir-type/phase1-steps.md +512 -0
  99. package/hermes/doc/plans/ir-type/progress.md +239 -0
  100. package/hermes/doc/plans/ir-type/typeinference-primitive-fastpath-design.md +203 -0
  101. package/hermes/doc/plans/ir-type/typeinference-primitive-fastpath-results.md +71 -0
  102. package/hermes/doc/superpowers/plans/2026-07-28-worker-arraybuffer-input.md +597 -0
  103. package/hermes/doc/superpowers/plans/2026-08-18-jitemitter-split.md +1149 -0
  104. package/hermes/doc/superpowers/plans/2026-08-20-jit-type-asserts.md +969 -0
  105. package/hermes/doc/superpowers/plans/2026-08-23-jit-shared-compiler-driver.md +478 -0
  106. package/hermes/doc/superpowers/plans/2026-08-23-x86-64-jit-skeleton.md +797 -0
  107. package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-arith.md +444 -0
  108. package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-calls.md +261 -0
  109. package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-props.md +240 -0
  110. package/hermes/doc/superpowers/plans/2026-10-26-regexp-bytecode-sharing.md +2197 -0
  111. package/hermes/doc/superpowers/plans/2026-10-28-regexp-start-filter-and-exec-fast-paths.md +3981 -0
  112. package/hermes/doc/superpowers/specs/2026-07-28-worker-arraybuffer-input-design.md +206 -0
  113. package/hermes/doc/superpowers/specs/2026-08-18-jitemitter-split-design.md +530 -0
  114. package/hermes/doc/superpowers/specs/2026-08-20-jit-type-asserts-design.md +360 -0
  115. package/hermes/doc/superpowers/specs/2026-08-23-x86-64-jit-design.md +246 -0
  116. package/hermes/doc/superpowers/specs/2026-08-26-icu-free-normalize-design.md +355 -0
  117. package/hermes/doc/superpowers/specs/2026-08-27-icu-free-convert-to-case-design.md +305 -0
  118. package/hermes/doc/superpowers/specs/2026-08-27-icu-free-locale-compare-design.md +429 -0
  119. package/hermes/doc/superpowers/specs/2026-08-29-icu-free-date-format-design.md +297 -0
  120. package/hermes/doc/superpowers/specs/2026-10-26-regexp-bytecode-sharing-design.md +605 -0
  121. package/hermes/doc/superpowers/specs/2026-10-28-regexp-start-filter-and-exec-fast-paths-design.md +551 -0
  122. package/hermes/doc/typescript-stripping.md +90 -0
  123. package/hermes/external/CMakeLists.txt +20 -0
  124. package/hermes/utils/IntlGen/IntlGen.java +531 -0
  125. package/hermes/utils/bench_with_stats.py +827 -0
  126. package/hermes/utils/build-apple-framework.sh +323 -0
  127. package/hermes/utils/chrome_snapshot_parser.py +210 -0
  128. package/hermes/utils/cmake-dev-build.sh +18 -0
  129. package/hermes/utils/commons.sh +55 -0
  130. package/hermes/utils/dump-cpp-funcs.sh +3 -0
  131. package/hermes/utils/es5objects.js +198 -0
  132. package/hermes/utils/format.sh +145 -0
  133. package/hermes/utils/gen-promise-internal-bc.sh +66 -0
  134. package/hermes/utils/genUnicodeTable.py +2503 -0
  135. package/hermes/utils/hermes-lit/CMakeLists.txt +22 -0
  136. package/hermes/utils/hermes-lit/hermes-lit.in +15 -0
  137. package/hermes/utils/jit/README.md +134 -0
  138. package/hermes/utils/jit/jit-diff.sh +160 -0
  139. package/hermes/utils/jit/jit-dump.sh +193 -0
  140. package/hermes/utils/lit-expect-gen/generate.py +217 -0
  141. package/hermes/utils/promise/index.js +15 -0
  142. package/hermes/utils/promise/package.json +13 -0
  143. package/hermes/utils/promise/rollup.config.js +19 -0
  144. package/hermes/utils/promise/yarn.lock +247 -0
  145. package/hermes/utils/scripts/hermes/consts.js +26 -0
  146. package/hermes/utils/scripts/hermes/create-tarball.js +75 -0
  147. package/hermes/utils/scripts/hermes/get-hermes-version.js +57 -0
  148. package/hermes/utils/scripts/hermes/hermes-utils.js +122 -0
  149. package/hermes/utils/scripts/hermes/package.json +6 -0
  150. package/hermes/utils/scripts/hermes/prepare-artifacts.js +113 -0
  151. package/hermes/utils/scripts/hermes/publish-artifacts.js +109 -0
  152. package/hermes/utils/scripts/hermes/publish-npm.js +96 -0
  153. package/hermes/utils/scripts/hermes/scm-utils.js +41 -0
  154. package/hermes/utils/scripts/hermes/set-artifacts-version.js +64 -0
  155. package/hermes/utils/scripts/hermes/version-utils.js +98 -0
  156. package/hermes/utils/scripts/hermes/yarn.lock +240 -0
  157. package/hermes/utils/summarize_sizes.py +184 -0
  158. package/hermes/utils/symbolicate-nativecall-stats.py +112 -0
  159. package/hermes/utils/test_runner.py +13 -0
  160. package/hermes/utils/testsuite/README.facebook +3 -0
  161. package/hermes/utils/testsuite/README.md +69 -0
  162. package/hermes/utils/testsuite/cli.py +547 -0
  163. package/hermes/utils/testsuite/es_ast.py +337 -0
  164. package/hermes/utils/testsuite/external/LICENSE +28 -0
  165. package/hermes/utils/testsuite/external/README.facebook +8 -0
  166. package/hermes/utils/testsuite/external/__init__.py +0 -0
  167. package/hermes/utils/testsuite/external/_monkeyYaml.py +164 -0
  168. package/hermes/utils/testsuite/external/parse_test262.py +141 -0
  169. package/hermes/utils/testsuite/hermes.py +522 -0
  170. package/hermes/utils/testsuite/preprocess.py +365 -0
  171. package/hermes/utils/testsuite/progress.py +377 -0
  172. package/hermes/utils/testsuite/skiplist.json +4356 -0
  173. package/hermes/utils/testsuite/skiplist.py +270 -0
  174. package/hermes/utils/testsuite/test_run_defs.py +435 -0
  175. package/hermes/utils/testsuite/typing_defs.py +52 -0
  176. package/hermes/utils/testsuite/utils.py +214 -0
  177. package/hermes/utils/tidy.sh +22 -0
  178. package/hermes/utils/update-fbcode-hermes.sh +53 -0
  179. package/hermes/utils/updateErrorTest.py +193 -0
  180. package/hermes/utils/wasm-compile.sh +65 -0
  181. package/package.json +1 -1
@@ -0,0 +1,220 @@
1
+ # Hermes IR Type System
2
+
3
+ ## Overview
4
+
5
+ The IR type system represents the set of possible runtime types a value can have at
6
+ a given program point. It uses a **bitmask-based union type** encoding: each bit in
7
+ a 16-bit integer represents one primitive type, and a `Type` value is the set of
8
+ types that a value *might* be. This makes union, intersection, and subset operations
9
+ trivial bitwise operations. The entire `Type` fits in 2 bytes.
10
+
11
+ **Key files:**
12
+ - `include/hermes/IR/IR.h:58-414` — `Type` class and `TypeKind` enum
13
+ - `lib/Optimizer/Scalar/TypeInference.cpp` — type inference pass
14
+ - `lib/IR/IR.cpp:1040-1080` — type printing
15
+
16
+ ## Primitive Types (TypeKind)
17
+
18
+ Each type occupies one bit in the bitmask (`include/hermes/IR/IR.h:61-86`):
19
+
20
+ | Bit | TypeKind | Description |
21
+ |-----|---------------|-------------|
22
+ | 0 | Empty | TDZ — variable before its declaration |
23
+ | 1 | Uninit | After declaration, before initialization (maps to `undefined` at runtime) |
24
+ | 2 | Undefined | The JS `undefined` value |
25
+ | 3 | Null | The JS `null` value |
26
+ | 4 | Boolean | `true` or `false` |
27
+ | 5 | String | JS string |
28
+ | 6 | Number | IEEE 754 double |
29
+ | 7 | BigInt | Arbitrary-precision integer |
30
+ | 8 | Symbol | ES2015 symbol |
31
+ | 9 | Environment | Lexical scope (internal; not mixed with JS types) |
32
+ | 10 | PrivateName | Private class field name (internal) |
33
+ | 11 | FunctionCode | IR function reference, not a JS closure |
34
+ | 12 | Object | JS object (including arrays, functions, regexps, etc.) |
35
+
36
+ 13 types total. Types 0-8 and 12 can appear in user-facing values; 9-11 are
37
+ internal to the compiler.
38
+
39
+ ## Composite / Pre-computed Masks
40
+
41
+ Defined as constants in `IR.h:122-134`:
42
+
43
+ | Name | Bits | Meaning |
44
+ |------|------|---------|
45
+ | `TYPE_ANY_MASK` | all except Empty, Uninit | Standard "any" — all observable JS types |
46
+ | `TYPE_ANY_EMPTY_UNINIT_MASK` | all except Environment, PrivateName, FunctionCode | "any" including TDZ states |
47
+ | `PRIMITIVE_BITS` | Number \| String \| BigInt \| Null \| Undefined \| Boolean \| Symbol | JS primitives |
48
+ | `NONPTR_BITS` | Number \| Boolean \| Null \| Undefined | Non-pointer values (useful for GC) |
49
+
50
+ ## Type Operations
51
+
52
+ All operations are `constexpr` and work on bitmasks:
53
+
54
+ ```cpp
55
+ // Union: value could be either type
56
+ static Type unionTy(Type A, Type B); // A.bitmask_ | B.bitmask_
57
+
58
+ // Intersection: only types in both
59
+ static Type intersectTy(Type A, Type B); // A.bitmask_ & B.bitmask_
60
+
61
+ // Subtraction: remove types in B from A
62
+ static Type subtractTy(Type A, Type B); // A.bitmask_ & ~B.bitmask_
63
+ ```
64
+
65
+ ### Querying
66
+
67
+ - `isSubsetOf(Type t)` — all bits of `this` are in `t`
68
+ - `canBeType(Type t)` — non-empty intersection
69
+ - `isProperSubsetOf(Type t)` — strict subset
70
+ - `isPrimitive()` — only bits in `PRIMITIVE_BITS`
71
+ - `isNonPtr()` — only bits in `NONPTR_BITS`
72
+ - `isKnownPrimitiveType()` — exactly one primitive bit set
73
+
74
+ ### Special Values
75
+
76
+ - `createNoType()` — empty bitmask (0). Represents "impossible" / unreachable.
77
+ - `createAnyType()` — `TYPE_ANY_MASK`. Default for unknown values.
78
+
79
+ ## How Types Attach to the IR
80
+
81
+ Every `Value` (base class for instructions, literals, parameters, etc.) carries a
82
+ `Type valueType` member (`IR.h:712`), defaulting to `createAnyType()`.
83
+
84
+ ### Literals Get Exact Types
85
+
86
+ | Literal class | Type |
87
+ |---------------|------|
88
+ | `LiteralEmpty` | Empty |
89
+ | `LiteralUninit` | Uninit |
90
+ | `LiteralUndefined` | Undefined |
91
+ | `LiteralNull` | Null |
92
+ | `LiteralNumber` | Number (or Int32 if the value fits) |
93
+ | `LiteralString` | String |
94
+ | `LiteralBigInt` | BigInt |
95
+ | `LiteralBool` | Boolean |
96
+ | `GlobalObject` | Object |
97
+
98
+ ### Instructions Declare Inherent Types
99
+
100
+ Instructions can declare `static Optional<Type> getInherentTypeImpl()` to declare
101
+ a type that is always correct regardless of operands:
102
+
103
+ - Arithmetic/conversion: `AsNumberInst` → Number, `AsInt32Inst` → Int32
104
+ - Allocation: `AllocArrayInst`, `AllocObjectLiteralInst`, `CreateFunctionInst` → Object
105
+ - Scope: `CreateScopeInst`, `ResolveScopeInst`, `GetParentScopeInst` → Environment
106
+ - Type queries: `TypeOfInst` → String
107
+ - Coercion: `AddEmptyStringInst` → String, `ToPropertyKeyInst` → String | Symbol
108
+
109
+ Instructions without an inherent type (e.g. `LoadPropertyInst`, `CallInst`,
110
+ `CatchInst`) default to `any` and rely on the inference pass.
111
+
112
+ ## Type Inference Pass
113
+
114
+ **File:** `lib/Optimizer/Scalar/TypeInference.cpp`
115
+
116
+ A whole-program, fixed-point, forward type inference that narrows value types.
117
+
118
+ ### Algorithm
119
+
120
+ 1. **Partition** functions and variables into groups (union-find) based on mutual
121
+ use. Functions that call each other or share variables are in the same partition.
122
+
123
+ 2. **Clear** all instruction types to their inherent type (or NoType). Save
124
+ pre-pass types as upper bounds.
125
+
126
+ 3. **Fixed-point iteration** over each partition:
127
+ - Infer parameter types from call sites (union of all actual arguments).
128
+ - Infer instruction types from operand types (see rules below).
129
+ - Infer return types from `ReturnInst` values.
130
+ - Infer variable/stack types from stored values.
131
+ - Repeat until no type changes.
132
+
133
+ 4. **Clamp**: intersect inferred types with pre-pass types to prevent widening
134
+ beyond what was previously known.
135
+
136
+ ### Inference Rules for Binary Operations
137
+
138
+ | Operation | Result Type |
139
+ |-----------|-------------|
140
+ | Comparisons (`==`, `<`, `instanceof`, etc.) | Boolean |
141
+ | `+` with a String operand | String |
142
+ | `+` of two Numbers | Number |
143
+ | `+` of two BigInts | BigInt |
144
+ | `+` of two non-string primitives | Number \| BigInt |
145
+ | `+` general case | String \| Number \| BigInt |
146
+ | `-`, `*`, `/`, `**` | Number \| BigInt |
147
+ | `<<`, `>>` | Number \| BigInt |
148
+ | `>>>` | Uint32 (subtype of Number) |
149
+ | `&`, `\|`, `^` | Int32 \| BigInt |
150
+ | `%` | Int32 \| BigInt |
151
+
152
+ ### Inference Rules for Unary Operations
153
+
154
+ | Operation | Result Type |
155
+ |-----------|-------------|
156
+ | `typeof` | String |
157
+ | `void` | Undefined |
158
+ | `!` | Boolean |
159
+ | `-`, `++`, `--` on Number | Number |
160
+ | `-`, `++`, `--` on BigInt | BigInt |
161
+ | `-`, `++`, `--` general | Number \| BigInt |
162
+ | `~` on Number | Int32 |
163
+ | `~` on BigInt | BigInt |
164
+ | `~` general | Int32 \| BigInt |
165
+
166
+ ### PHI Nodes
167
+
168
+ A PHI's type is the **union** of all its incoming values' types. The algorithm
169
+ recursively traverses nested PHIs to collect all non-PHI inputs.
170
+
171
+ ### Memory Locations (Variables, Stack Slots)
172
+
173
+ The inferred type of a memory location is the **union** of all values stored to it.
174
+
175
+ ### Parameters
176
+
177
+ If all call sites of a function are known, a parameter's type is the union of all
178
+ corresponding arguments across call sites (defaulting to Undefined for missing
179
+ arguments). If any call site is unknown, the parameter gets `any`.
180
+
181
+ ### Return Types
182
+
183
+ The return type of a function is the union of all `ReturnInst` operand types.
184
+ Generator functions always return `any` because `.return()` can inject any value.
185
+
186
+ ## Type Narrowing Instructions
187
+
188
+ Several instructions refine (narrow) types:
189
+
190
+ ### ThrowIfInst
191
+ Removes `Empty` and `Uninit` from the type — used for TDZ checks. After this
192
+ instruction, the value is known not to be in TDZ.
193
+
194
+ ### CheckedTypeCastInst
195
+ Intersects the input type with a specified target type. If the intersection is
196
+ empty, the code is unreachable.
197
+
198
+ ### UnionNarrowTrustedInst
199
+ Intersects a saved result type with the operand type. Used after conditional
200
+ branches to narrow union types (e.g., after a `typeof` check).
201
+
202
+ ## Type Printing
203
+
204
+ Types are printed as pipe-separated names: `number|string|undefined`. Special
205
+ cases:
206
+ - Empty bitmask → `notype`
207
+ - All types except Empty/Uninit → `any`
208
+ - All types including Empty/Uninit → `any|empty|uninit`
209
+
210
+ ## Design Properties
211
+
212
+ - **Monotonic narrowing**: the inference pass can only narrow types, never widen
213
+ them beyond the pre-pass upper bound.
214
+ - **Conservative**: if in doubt, the type is `any`. Soundness is prioritized
215
+ over precision.
216
+ - **No nominal object types**: Object is a single type — there is no
217
+ `Array`, `RegExp`, `Function` distinction in the IR type system.
218
+ - **No function signature types**: `FunctionCode` is a single type with no
219
+ parameter/return type information embedded.
220
+ - **Cheap**: 2-byte representation, all operations are bitwise, no allocations.