cfsolve 0.1.1 → 0.1.3

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 (404) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +10 -9
  4. data/THIRD_PARTY_LICENSES/README.md +71 -254
  5. data/THIRD_PARTY_LICENSES/{derive_builder_macro-0.20.2/LICENSE-APACHE → bytecount-0.6.9/LICENSE.Apache2} +0 -1
  6. data/THIRD_PARTY_LICENSES/{darling-0.20.11/LICENSE → bytecount-0.6.9/LICENSE.MIT} +1 -3
  7. data/THIRD_PARTY_LICENSES/{ident_case-1.0.1/LICENSE → cobs-0.3.0/LICENSE-MIT} +1 -1
  8. data/THIRD_PARTY_LICENSES/cow-utils-0.1.3/LICENSE +21 -0
  9. data/THIRD_PARTY_LICENSES/{hashbrown-0.14.5 → embedded-io-0.4.0}/LICENSE-MIT +1 -1
  10. data/THIRD_PARTY_LICENSES/{ahash-0.8.12 → embedded-io-0.6.1}/LICENSE-MIT +1 -1
  11. data/THIRD_PARTY_LICENSES/{browserslist-data-0.1.4 → escape-simd-0.1.1}/LICENSE +1 -1
  12. data/THIRD_PARTY_LICENSES/escape-simd-0.1.1/NOTICE +62 -0
  13. data/THIRD_PARTY_LICENSES/json-escape-simd-3.1.3/LICENSE +21 -0
  14. data/THIRD_PARTY_LICENSES/{miette-7.6.0/LICENSE → json-escape-simd-3.1.3/LICENSE-APACHE} +0 -1
  15. data/THIRD_PARTY_LICENSES/json-escape-simd-3.1.3/NOTICE +62 -0
  16. data/THIRD_PARTY_LICENSES/memchr-2.8.3/UNLICENSE +24 -0
  17. data/THIRD_PARTY_LICENSES/{derive_builder_core-0.20.2 → nonmax-0.5.5}/LICENSE-APACHE +1 -2
  18. data/THIRD_PARTY_LICENSES/{dashmap-5.5.3/LICENSE → nonmax-0.5.5/LICENSE-MIT} +2 -4
  19. data/THIRD_PARTY_LICENSES/{rand-0.8.5 → num-bigint-0.5.1}/LICENSE-MIT +0 -1
  20. data/THIRD_PARTY_LICENSES/oxc-0.157.0/LICENSE +22 -0
  21. data/THIRD_PARTY_LICENSES/oxc-0.157.0/THIRD-PARTY-LICENSE +763 -0
  22. data/THIRD_PARTY_LICENSES/{browserslist-rs-0.19.0 → oxc-browserslist-5.0.1}/LICENSE +1 -0
  23. data/THIRD_PARTY_LICENSES/oxc_allocator-0.157.0/LICENSE +22 -0
  24. data/THIRD_PARTY_LICENSES/oxc_allocator-0.157.0/THIRD-PARTY-LICENSE +763 -0
  25. data/THIRD_PARTY_LICENSES/oxc_ast-0.157.0/LICENSE +22 -0
  26. data/THIRD_PARTY_LICENSES/oxc_ast-0.157.0/THIRD-PARTY-LICENSE +763 -0
  27. data/THIRD_PARTY_LICENSES/oxc_ast_macros-0.157.0/LICENSE +22 -0
  28. data/THIRD_PARTY_LICENSES/oxc_ast_macros-0.157.0/THIRD-PARTY-LICENSE +763 -0
  29. data/THIRD_PARTY_LICENSES/oxc_ast_visit-0.157.0/LICENSE +22 -0
  30. data/THIRD_PARTY_LICENSES/oxc_ast_visit-0.157.0/THIRD-PARTY-LICENSE +763 -0
  31. data/THIRD_PARTY_LICENSES/oxc_codegen-0.157.0/LICENSE +22 -0
  32. data/THIRD_PARTY_LICENSES/oxc_codegen-0.157.0/THIRD-PARTY-LICENSE +763 -0
  33. data/THIRD_PARTY_LICENSES/oxc_compat-0.157.0/LICENSE +22 -0
  34. data/THIRD_PARTY_LICENSES/oxc_compat-0.157.0/THIRD-PARTY-LICENSE +763 -0
  35. data/THIRD_PARTY_LICENSES/oxc_data_structures-0.157.0/LICENSE +22 -0
  36. data/THIRD_PARTY_LICENSES/oxc_data_structures-0.157.0/THIRD-PARTY-LICENSE +763 -0
  37. data/THIRD_PARTY_LICENSES/oxc_diagnostics-0.157.0/LICENSE +22 -0
  38. data/THIRD_PARTY_LICENSES/oxc_diagnostics-0.157.0/THIRD-PARTY-LICENSE +763 -0
  39. data/THIRD_PARTY_LICENSES/oxc_ecmascript-0.157.0/LICENSE +22 -0
  40. data/THIRD_PARTY_LICENSES/oxc_ecmascript-0.157.0/THIRD-PARTY-LICENSE +763 -0
  41. data/THIRD_PARTY_LICENSES/oxc_estree-0.157.0/LICENSE +22 -0
  42. data/THIRD_PARTY_LICENSES/oxc_estree-0.157.0/THIRD-PARTY-LICENSE +763 -0
  43. data/THIRD_PARTY_LICENSES/oxc_index-5.0.0/LICENSE +22 -0
  44. data/THIRD_PARTY_LICENSES/oxc_parser-0.157.0/LICENSE +22 -0
  45. data/THIRD_PARTY_LICENSES/oxc_parser-0.157.0/THIRD-PARTY-LICENSE +763 -0
  46. data/THIRD_PARTY_LICENSES/oxc_regular_expression-0.157.0/LICENSE +22 -0
  47. data/THIRD_PARTY_LICENSES/oxc_regular_expression-0.157.0/THIRD-PARTY-LICENSE +763 -0
  48. data/THIRD_PARTY_LICENSES/oxc_semantic-0.157.0/LICENSE +22 -0
  49. data/THIRD_PARTY_LICENSES/oxc_semantic-0.157.0/THIRD-PARTY-LICENSE +763 -0
  50. data/THIRD_PARTY_LICENSES/oxc_span-0.157.0/LICENSE +22 -0
  51. data/THIRD_PARTY_LICENSES/oxc_span-0.157.0/THIRD-PARTY-LICENSE +763 -0
  52. data/THIRD_PARTY_LICENSES/oxc_str-0.157.0/LICENSE +22 -0
  53. data/THIRD_PARTY_LICENSES/oxc_str-0.157.0/THIRD-PARTY-LICENSE +763 -0
  54. data/THIRD_PARTY_LICENSES/oxc_syntax-0.157.0/LICENSE +22 -0
  55. data/THIRD_PARTY_LICENSES/oxc_syntax-0.157.0/THIRD-PARTY-LICENSE +763 -0
  56. data/THIRD_PARTY_LICENSES/{fixedbitset-0.5.7 → postcard-1.1.3}/LICENSE-MIT +1 -1
  57. data/THIRD_PARTY_LICENSES/{bytes-str-0.2.7/LICENSE → self_cell-1.3.0/LICENSE-APACHE} +1 -2
  58. data/THIRD_PARTY_LICENSES/self_cell-1.3.0/LICENSE-GPLv2 +339 -0
  59. data/THIRD_PARTY_LICENSES/{darling_core-0.20.11 → smawk-0.3.3}/LICENSE +1 -1
  60. data/UPSTREAM.md +10 -8
  61. data/ext/cfsolve/Cargo.lock +534 -1727
  62. data/ext/cfsolve/Cargo.toml +4 -0
  63. data/ext/cfsolve/src/main.rs +1 -1
  64. data/lib/cfsolve/profiles/safari-26-ios/answers.json +2570 -1894
  65. data/lib/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +1867 -1192
  66. data/lib/cfsolve/profiles/safari-26-ios.json +102 -156
  67. data/lib/cfsolve/version.rb +2 -2
  68. data/vendor/cfsolve/Cargo.lock +561 -1729
  69. data/vendor/cfsolve/Cargo.toml +26 -8
  70. data/vendor/cfsolve/README.md +4 -35
  71. data/vendor/cfsolve/examples/build_profile.rs +17 -15
  72. data/vendor/cfsolve/examples/capture_session.rs +37 -0
  73. data/vendor/cfsolve/examples/check_answers.rs +66 -0
  74. data/vendor/cfsolve/examples/compare_session.rs +189 -0
  75. data/vendor/cfsolve/examples/solver_profile.rs +84 -0
  76. data/vendor/cfsolve/examples/solver_smoke.rs +9 -8
  77. data/vendor/cfsolve/examples/stage2_snapshot.rs +6 -3
  78. data/vendor/cfsolve/examples/tls_echo.rs +3 -3
  79. data/vendor/cfsolve/examples/vm_snapshot.rs +32 -33
  80. data/vendor/cfsolve/profiles/safari-26-ios/answers.json +2570 -1894
  81. data/vendor/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +1867 -1192
  82. data/vendor/cfsolve/profiles/safari-26-ios.json +102 -156
  83. data/vendor/cfsolve/scripts/capture_cssom.mjs +42 -0
  84. data/vendor/cfsolve/scripts/serve_cssom.py +111 -0
  85. data/vendor/cfsolve/src/bin/capture-proxy/main.rs +3 -2
  86. data/vendor/cfsolve/src/bin/challenge/cli.rs +8 -2
  87. data/vendor/cfsolve/src/bin/challenge/main.rs +7 -2
  88. data/vendor/cfsolve/src/capture/profile.rs +7 -18
  89. data/vendor/cfsolve/src/capture/proxy/tests.rs +1 -1
  90. data/vendor/cfsolve/src/capture/proxy.rs +44 -13
  91. data/vendor/cfsolve/src/capture/recorded.rs +42 -7
  92. data/vendor/cfsolve/src/capture/sessions.rs +4 -3
  93. data/vendor/cfsolve/src/capture/upstream.rs +1 -1
  94. data/vendor/cfsolve/src/challenge/codec.rs +4 -2
  95. data/vendor/cfsolve/src/challenge/expression.rs +161 -117
  96. data/vendor/cfsolve/src/challenge/installed/audit.rs +132 -0
  97. data/vendor/cfsolve/src/challenge/installed.rs +127 -269
  98. data/vendor/cfsolve/src/challenge/merge.rs +120 -80
  99. data/vendor/cfsolve/src/challenge/orchestrator.rs +57 -44
  100. data/vendor/cfsolve/src/challenge/payload.rs +175 -35
  101. data/vendor/cfsolve/src/challenge/program.rs +197 -178
  102. data/vendor/cfsolve/src/challenge/reduced_timing.rs +55 -40
  103. data/vendor/cfsolve/src/challenge/source.rs +151 -96
  104. data/vendor/cfsolve/src/challenge/state.rs +236 -122
  105. data/vendor/cfsolve/src/challenge/tally.rs +64 -50
  106. data/vendor/cfsolve/src/challenge.rs +1 -0
  107. data/vendor/cfsolve/src/deobfuscate/analysis/bindings.rs +187 -185
  108. data/vendor/cfsolve/src/deobfuscate/analysis/effects.rs +42 -51
  109. data/vendor/cfsolve/src/deobfuscate/analysis/hoisting.rs +147 -228
  110. data/vendor/cfsolve/src/deobfuscate/analysis/properties.rs +250 -425
  111. data/vendor/cfsolve/src/deobfuscate/analysis/unconditional.rs +79 -0
  112. data/vendor/cfsolve/src/deobfuscate/analysis.rs +259 -41
  113. data/vendor/cfsolve/src/deobfuscate/argument_arrays.rs +70 -73
  114. data/vendor/cfsolve/src/deobfuscate/arrow_blocks.rs +91 -104
  115. data/vendor/cfsolve/src/deobfuscate/ast.rs +383 -0
  116. data/vendor/cfsolve/src/deobfuscate/bitwise.rs +44 -54
  117. data/vendor/cfsolve/src/deobfuscate/blocks.rs +36 -29
  118. data/vendor/cfsolve/src/deobfuscate/call_helpers.rs +80 -131
  119. data/vendor/cfsolve/src/deobfuscate/control_flow.rs +239 -297
  120. data/vendor/cfsolve/src/deobfuscate/copy_propagation.rs +114 -135
  121. data/vendor/cfsolve/src/deobfuscate/dead_branches.rs +62 -61
  122. data/vendor/cfsolve/src/deobfuscate/dead_properties.rs +197 -214
  123. data/vendor/cfsolve/src/deobfuscate/dispatch.rs +238 -298
  124. data/vendor/cfsolve/src/deobfuscate/encoded_strings.rs +201 -205
  125. data/vendor/cfsolve/src/deobfuscate/function_lengths.rs +32 -38
  126. data/vendor/cfsolve/src/deobfuscate/helper_objects.rs +346 -536
  127. data/vendor/cfsolve/src/deobfuscate/hygiene.rs +197 -0
  128. data/vendor/cfsolve/src/deobfuscate/int32_helpers.rs +121 -155
  129. data/vendor/cfsolve/src/deobfuscate/literals.rs +116 -67
  130. data/vendor/cfsolve/src/deobfuscate/loops.rs +43 -43
  131. data/vendor/cfsolve/src/deobfuscate/memoized_strings.rs +127 -131
  132. data/vendor/cfsolve/src/deobfuscate/merged_functions.rs +262 -220
  133. data/vendor/cfsolve/src/deobfuscate/pipeline.rs +199 -244
  134. data/vendor/cfsolve/src/deobfuscate/register_arrays.rs +361 -322
  135. data/vendor/cfsolve/src/deobfuscate/removal.rs +83 -52
  136. data/vendor/cfsolve/src/deobfuscate/simplify.rs +147 -0
  137. data/vendor/cfsolve/src/deobfuscate/state_machines.rs +88 -110
  138. data/vendor/cfsolve/src/deobfuscate/statements.rs +228 -228
  139. data/vendor/cfsolve/src/deobfuscate/static_members.rs +46 -31
  140. data/vendor/cfsolve/src/deobfuscate/testing.rs +49 -59
  141. data/vendor/cfsolve/src/deobfuscate/unused_bindings.rs +92 -102
  142. data/vendor/cfsolve/src/deobfuscate.rs +15 -11
  143. data/vendor/cfsolve/src/embedding_page/extra_params.rs +23 -32
  144. data/vendor/cfsolve/src/embedding_page/page.rs +28 -2
  145. data/vendor/cfsolve/src/embedding_page/render_sample.rs +184 -147
  146. data/vendor/cfsolve/src/error.rs +40 -5
  147. data/vendor/cfsolve/src/fingerprint.rs +8 -2
  148. data/vendor/cfsolve/src/http/client.rs +9 -1
  149. data/vendor/cfsolve/src/http/requests.rs +2 -2
  150. data/vendor/cfsolve/src/js/ast.rs +479 -254
  151. data/vendor/cfsolve/src/js/objects.rs +9 -2
  152. data/vendor/cfsolve/src/lib.rs +1 -0
  153. data/vendor/cfsolve/src/listing/fold.rs +19 -92
  154. data/vendor/cfsolve/src/listing/query.rs +26 -291
  155. data/vendor/cfsolve/src/listing.rs +0 -1
  156. data/vendor/cfsolve/src/performance_clock.rs +20 -1
  157. data/vendor/cfsolve/src/profiling.rs +49 -0
  158. data/vendor/cfsolve/src/script.rs +35 -24
  159. data/vendor/cfsolve/src/session/challenge_page.rs +41 -21
  160. data/vendor/cfsolve/src/session/channel.rs +2 -2
  161. data/vendor/cfsolve/src/session/initial.rs +19 -10
  162. data/vendor/cfsolve/src/session/probes.rs +160 -125
  163. data/vendor/cfsolve/src/session/sink.rs +26 -1
  164. data/vendor/cfsolve/src/session/tests/challenge_page.rs +36 -1
  165. data/vendor/cfsolve/src/session/timing.rs +58 -53
  166. data/vendor/cfsolve/src/session/widget.rs +5 -6
  167. data/vendor/cfsolve/src/session.rs +1 -1
  168. data/vendor/cfsolve/src/solver.rs +3 -1
  169. data/vendor/cfsolve/src/stage2/analysis/analyze.rs +50 -33
  170. data/vendor/cfsolve/src/stage2/analysis/audit.rs +4 -2
  171. data/vendor/cfsolve/src/stage2/analysis/discovery.rs +61 -66
  172. data/vendor/cfsolve/src/stage2/analysis/envelope.rs +33 -22
  173. data/vendor/cfsolve/src/stage2/analysis/recognize.rs +3 -5
  174. data/vendor/cfsolve/src/stage2/analysis.rs +0 -1
  175. data/vendor/cfsolve/src/stage2/audit_globals.rs +378 -0
  176. data/vendor/cfsolve/src/stage2/benchmark.rs +66 -38
  177. data/vendor/cfsolve/src/stage2/call_stack.rs +1463 -1017
  178. data/vendor/cfsolve/src/stage2/challenge_page.rs +3 -2
  179. data/vendor/cfsolve/src/stage2/interaction/checkbox.rs +202 -150
  180. data/vendor/cfsolve/src/stage2/interaction/click.rs +2 -2
  181. data/vendor/cfsolve/src/stage2/interaction/native.rs +2 -1
  182. data/vendor/cfsolve/src/stage2/interaction/plan.rs +5 -7
  183. data/vendor/cfsolve/src/stage2/payload/recover.rs +56 -25
  184. data/vendor/cfsolve/src/stage2/probes/clock.rs +1 -3
  185. data/vendor/cfsolve/src/stage2/probes/ice.rs +11 -10
  186. data/vendor/cfsolve/src/stage2/probes/media.rs +47 -33
  187. data/vendor/cfsolve/src/stage2/probes/performance.rs +13 -8
  188. data/vendor/cfsolve/src/stage2/probes/rects.rs +12 -17
  189. data/vendor/cfsolve/src/stage2/probes/stack.rs +50 -103
  190. data/vendor/cfsolve/src/stage2/probes/websocket_echo.rs +17 -86
  191. data/vendor/cfsolve/src/stage2/probes.rs +0 -1
  192. data/vendor/cfsolve/src/stage2/queries.rs +50 -0
  193. data/vendor/cfsolve/src/stage2/records.rs +4 -13
  194. data/vendor/cfsolve/src/stage2/reference.json +1 -1
  195. data/vendor/cfsolve/src/stage2/reference.rs +98 -100
  196. data/vendor/cfsolve/src/stage2/registry.rs +41 -34
  197. data/vendor/cfsolve/src/stage2/replay.rs +182 -254
  198. data/vendor/cfsolve/src/stage2/stylesheets.rs +176 -0
  199. data/vendor/cfsolve/src/stage2/syntax.rs +88 -0
  200. data/vendor/cfsolve/src/stage2/trace.rs +152 -108
  201. data/vendor/cfsolve/src/stage2/vocabulary.rs +103 -403
  202. data/vendor/cfsolve/src/stage2.rs +4 -1
  203. data/vendor/cfsolve/src/vm/disassemble.rs +46 -13
  204. data/vendor/cfsolve/src/vm/dispatch.rs +93 -65
  205. data/vendor/cfsolve/src/vm/extract.rs +347 -250
  206. data/vendor/cfsolve/src/vm/interpret/access.rs +67 -68
  207. data/vendor/cfsolve/src/vm/interpret/builtin.rs +16 -63
  208. data/vendor/cfsolve/src/vm/interpret/call.rs +192 -51
  209. data/vendor/cfsolve/src/vm/interpret/compile.rs +643 -0
  210. data/vendor/cfsolve/src/vm/interpret/copies.rs +232 -120
  211. data/vendor/cfsolve/src/vm/interpret/evaluate/tests.rs +149 -40
  212. data/vendor/cfsolve/src/vm/interpret/evaluate.rs +189 -572
  213. data/vendor/cfsolve/src/vm/interpret/explore.rs +159 -46
  214. data/vendor/cfsolve/src/vm/interpret/formula.rs +131 -0
  215. data/vendor/cfsolve/src/vm/interpret/frozen.rs +169 -0
  216. data/vendor/cfsolve/src/vm/interpret/intrinsic.rs +414 -0
  217. data/vendor/cfsolve/src/vm/interpret/mix32.rs +189 -0
  218. data/vendor/cfsolve/src/vm/interpret/native_dispatch.rs +220 -0
  219. data/vendor/cfsolve/src/vm/interpret/pattern.rs +1736 -0
  220. data/vendor/cfsolve/src/vm/interpret/plan.rs +605 -330
  221. data/vendor/cfsolve/src/vm/interpret/register_helpers.rs +384 -0
  222. data/vendor/cfsolve/src/vm/interpret/run.rs +314 -54
  223. data/vendor/cfsolve/src/vm/interpret/semantics.rs +71 -46
  224. data/vendor/cfsolve/src/vm/interpret/setup.rs +80 -45
  225. data/vendor/cfsolve/src/vm/interpret/string_decoder.rs +482 -0
  226. data/vendor/cfsolve/src/vm/interpret.rs +16 -3
  227. data/vendor/cfsolve/src/vm/machine.rs +58 -47
  228. data/vendor/cfsolve/src/vm/output.rs +13 -5
  229. data/vendor/cfsolve/src/vm/packed_names.rs +311 -0
  230. data/vendor/cfsolve/src/vm/session.rs +197 -110
  231. data/vendor/cfsolve/src/vm/value.rs +35 -19
  232. data/vendor/cfsolve/src/vm.rs +3 -1
  233. data/vendor/cfsolve/vendor/btls-sys/Cargo.toml +3 -0
  234. data/vendor/cfsolve/vendor/btls-sys/build/main.rs +20 -0
  235. data/vendor/cfsolve/vendor/btls-sys/src/lib.rs +3 -0
  236. metadata +106 -183
  237. data/THIRD_PARTY_LICENSES/Inflector-0.11.4/LICENSE.md +0 -22
  238. data/THIRD_PARTY_LICENSES/arrayvec-0.7.6/LICENSE-MIT +0 -25
  239. data/THIRD_PARTY_LICENSES/ascii-1.1.0/LICENSE-APACHE +0 -201
  240. data/THIRD_PARTY_LICENSES/ascii-1.1.0/LICENSE-MIT +0 -22
  241. data/THIRD_PARTY_LICENSES/ast_node-5.0.0/LICENSE +0 -201
  242. data/THIRD_PARTY_LICENSES/better_scoped_tls-1.0.1/LICENSE +0 -201
  243. data/THIRD_PARTY_LICENSES/bitvec-1.0.1/LICENSE.txt +0 -21
  244. data/THIRD_PARTY_LICENSES/bstr-1.12.1/COPYING +0 -8
  245. data/THIRD_PARTY_LICENSES/bstr-1.12.1/LICENSE-MIT +0 -21
  246. data/THIRD_PARTY_LICENSES/cargo-platform-0.1.9/LICENSE-APACHE +0 -201
  247. data/THIRD_PARTY_LICENSES/cargo_metadata-0.19.2/LICENSE-MIT +0 -23
  248. data/THIRD_PARTY_LICENSES/darling_macro-0.20.11/LICENSE +0 -21
  249. data/THIRD_PARTY_LICENSES/debugid-0.8.0/LICENSE +0 -201
  250. data/THIRD_PARTY_LICENSES/derive_builder-0.20.2/LICENSE-MIT +0 -21
  251. data/THIRD_PARTY_LICENSES/derive_builder_core-0.20.2/LICENSE-MIT +0 -21
  252. data/THIRD_PARTY_LICENSES/derive_builder_macro-0.20.2/LICENSE-MIT +0 -21
  253. data/THIRD_PARTY_LICENSES/foldhash-0.1.5/LICENSE +0 -19
  254. data/THIRD_PARTY_LICENSES/from_variant-3.0.0/LICENSE +0 -201
  255. data/THIRD_PARTY_LICENSES/funty-2.0.0/LICENSE.txt +0 -21
  256. data/THIRD_PARTY_LICENSES/hashbrown-0.16.1/LICENSE-MIT +0 -25
  257. data/THIRD_PARTY_LICENSES/heck-0.5.0/LICENSE-APACHE +0 -201
  258. data/THIRD_PARTY_LICENSES/hermit-abi-0.5.2/LICENSE-APACHE +0 -201
  259. data/THIRD_PARTY_LICENSES/hermit-abi-0.5.2/LICENSE-MIT +0 -23
  260. data/THIRD_PARTY_LICENSES/hstr-3.0.3/LICENSE +0 -202
  261. data/THIRD_PARTY_LICENSES/if_chain-1.0.3/LICENSE-APACHE +0 -201
  262. data/THIRD_PARTY_LICENSES/if_chain-1.0.3/LICENSE-MIT +0 -25
  263. data/THIRD_PARTY_LICENSES/is-macro-0.3.7/LICENSE +0 -202
  264. data/THIRD_PARTY_LICENSES/itoa-1.0.17/LICENSE-MIT +0 -23
  265. data/THIRD_PARTY_LICENSES/jsonc-parser-0.26.3/LICENSE +0 -21
  266. data/THIRD_PARTY_LICENSES/lazy_static-1.5.0/LICENSE-APACHE +0 -201
  267. data/THIRD_PARTY_LICENSES/lazy_static-1.5.0/LICENSE-MIT +0 -25
  268. data/THIRD_PARTY_LICENSES/lru-0.16.2/LICENSE +0 -21
  269. data/THIRD_PARTY_LICENSES/memchr-2.7.6/COPYING +0 -3
  270. data/THIRD_PARTY_LICENSES/memchr-2.7.6/LICENSE-MIT +0 -21
  271. data/THIRD_PARTY_LICENSES/miette-derive-7.6.0/LICENSE +0 -229
  272. data/THIRD_PARTY_LICENSES/normpath-0.2.0/COPYRIGHT +0 -7
  273. data/THIRD_PARTY_LICENSES/normpath-0.2.0/LICENSE-MIT +0 -21
  274. data/THIRD_PARTY_LICENSES/normpath-0.2.0/LICENSE-THIRD-PARTY +0 -210
  275. data/THIRD_PARTY_LICENSES/num_cpus-1.17.0/LICENSE-APACHE +0 -201
  276. data/THIRD_PARTY_LICENSES/num_cpus-1.17.0/LICENSE-MIT +0 -20
  277. data/THIRD_PARTY_LICENSES/owo-colors-4.2.3/LICENSE +0 -21
  278. data/THIRD_PARTY_LICENSES/par-core-2.0.0/LICENSE +0 -202
  279. data/THIRD_PARTY_LICENSES/par-iter-2.0.0/LICENSE +0 -202
  280. data/THIRD_PARTY_LICENSES/path-clean-0.1.0/LICENSE-APACHE +0 -13
  281. data/THIRD_PARTY_LICENSES/path-clean-0.1.0/LICENSE-MIT +0 -18
  282. data/THIRD_PARTY_LICENSES/path-clean-1.0.1/LICENSE-APACHE +0 -13
  283. data/THIRD_PARTY_LICENSES/path-clean-1.0.1/LICENSE-MIT +0 -18
  284. data/THIRD_PARTY_LICENSES/pathdiff-0.2.3/LICENSE-APACHE +0 -201
  285. data/THIRD_PARTY_LICENSES/pathdiff-0.2.3/LICENSE-MIT +0 -23
  286. data/THIRD_PARTY_LICENSES/petgraph-0.7.1/LICENSE-APACHE +0 -201
  287. data/THIRD_PARTY_LICENSES/precomputed-map-0.2.0/LICENSE +0 -21
  288. data/THIRD_PARTY_LICENSES/preset_env_base-6.0.0/LICENSE +0 -201
  289. data/THIRD_PARTY_LICENSES/radium-0.7.0/LICENSE.txt +0 -21
  290. data/THIRD_PARTY_LICENSES/radix_fmt-1.0.0/LICENSE +0 -201
  291. data/THIRD_PARTY_LICENSES/rand-0.8.5/COPYRIGHT +0 -12
  292. data/THIRD_PARTY_LICENSES/rand-0.8.5/LICENSE-APACHE +0 -176
  293. data/THIRD_PARTY_LICENSES/rand_core-0.6.4/COPYRIGHT +0 -12
  294. data/THIRD_PARTY_LICENSES/rand_core-0.6.4/LICENSE-APACHE +0 -187
  295. data/THIRD_PARTY_LICENSES/rand_core-0.6.4/LICENSE-MIT +0 -26
  296. data/THIRD_PARTY_LICENSES/regress-0.10.5/LICENSE-APACHE +0 -201
  297. data/THIRD_PARTY_LICENSES/regress-0.10.5/LICENSE-MIT +0 -21
  298. data/THIRD_PARTY_LICENSES/ryu-1.0.22/LICENSE-APACHE +0 -176
  299. data/THIRD_PARTY_LICENSES/ryu-1.0.22/LICENSE-BOOST +0 -23
  300. data/THIRD_PARTY_LICENSES/scoped-tls-1.0.1/LICENSE-APACHE +0 -201
  301. data/THIRD_PARTY_LICENSES/scoped-tls-1.0.1/LICENSE-MIT +0 -25
  302. data/THIRD_PARTY_LICENSES/siphasher-0.3.11/COPYING +0 -7
  303. data/THIRD_PARTY_LICENSES/smallvec-1.15.1/LICENSE-APACHE +0 -201
  304. data/THIRD_PARTY_LICENSES/smartstring-1.0.1/LICENCE.md +0 -355
  305. data/THIRD_PARTY_LICENSES/st-map-0.2.4/LICENSE +0 -202
  306. data/THIRD_PARTY_LICENSES/static-map-macro-0.3.4/LICENSE +0 -202
  307. data/THIRD_PARTY_LICENSES/string_enum-1.0.2/LICENSE +0 -201
  308. data/THIRD_PARTY_LICENSES/strsim-0.11.1/LICENSE +0 -23
  309. data/THIRD_PARTY_LICENSES/swc-52.0.0/LICENSE +0 -201
  310. data/THIRD_PARTY_LICENSES/swc_allocator-4.0.1/LICENSE +0 -201
  311. data/THIRD_PARTY_LICENSES/swc_atoms-9.0.0/LICENSE +0 -201
  312. data/THIRD_PARTY_LICENSES/swc_common-18.0.1/LICENSE +0 -201
  313. data/THIRD_PARTY_LICENSES/swc_compiler_base-45.0.0/LICENSE +0 -201
  314. data/THIRD_PARTY_LICENSES/swc_config-3.1.2/LICENSE +0 -201
  315. data/THIRD_PARTY_LICENSES/swc_config_macro-1.0.1/LICENSE +0 -201
  316. data/THIRD_PARTY_LICENSES/swc_core-54.0.0/LICENSE +0 -201
  317. data/THIRD_PARTY_LICENSES/swc_ecma_ast-19.0.0/LICENSE +0 -201
  318. data/THIRD_PARTY_LICENSES/swc_ecma_codegen-21.0.0/LICENSE +0 -201
  319. data/THIRD_PARTY_LICENSES/swc_ecma_codegen_macros-2.0.2/LICENSE +0 -201
  320. data/THIRD_PARTY_LICENSES/swc_ecma_compat_bugfixes-39.0.0/LICENSE +0 -201
  321. data/THIRD_PARTY_LICENSES/swc_ecma_compat_common-30.0.0/LICENSE +0 -201
  322. data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2015-39.0.0/LICENSE +0 -201
  323. data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2016-35.0.0/LICENSE +0 -201
  324. data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2017-35.0.0/LICENSE +0 -201
  325. data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2018-36.0.0/LICENSE +0 -201
  326. data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2019-35.0.0/LICENSE +0 -201
  327. data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2020-37.0.0/LICENSE +0 -201
  328. data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2021-35.0.0/LICENSE +0 -201
  329. data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2022-37.0.0/LICENSE +0 -201
  330. data/THIRD_PARTY_LICENSES/swc_ecma_compat_es3-26.0.0/LICENSE +0 -201
  331. data/THIRD_PARTY_LICENSES/swc_ecma_ext_transforms-25.0.0/LICENSE +0 -201
  332. data/THIRD_PARTY_LICENSES/swc_ecma_hooks-0.3.0/LICENSE +0 -201
  333. data/THIRD_PARTY_LICENSES/swc_ecma_loader-18.0.0/LICENSE +0 -201
  334. data/THIRD_PARTY_LICENSES/swc_ecma_minifier-42.0.0/LICENSE +0 -201
  335. data/THIRD_PARTY_LICENSES/swc_ecma_parser-32.0.0/LICENSE +0 -201
  336. data/THIRD_PARTY_LICENSES/swc_ecma_preset_env-45.0.0/LICENSE +0 -201
  337. data/THIRD_PARTY_LICENSES/swc_ecma_transformer-6.0.0/LICENSE +0 -201
  338. data/THIRD_PARTY_LICENSES/swc_ecma_transforms-44.0.0/LICENSE +0 -201
  339. data/THIRD_PARTY_LICENSES/swc_ecma_transforms_base-35.0.0/LICENSE +0 -201
  340. data/THIRD_PARTY_LICENSES/swc_ecma_transforms_classes-35.0.0/LICENSE +0 -201
  341. data/THIRD_PARTY_LICENSES/swc_ecma_transforms_compat-40.0.0/LICENSE +0 -201
  342. data/THIRD_PARTY_LICENSES/swc_ecma_transforms_macros-1.0.1/LICENSE +0 -201
  343. data/THIRD_PARTY_LICENSES/swc_ecma_transforms_module-38.0.0/LICENSE +0 -201
  344. data/THIRD_PARTY_LICENSES/swc_ecma_transforms_optimization-37.0.0/LICENSE +0 -201
  345. data/THIRD_PARTY_LICENSES/swc_ecma_transforms_proposal-35.0.0/LICENSE +0 -201
  346. data/THIRD_PARTY_LICENSES/swc_ecma_transforms_react-38.0.0/LICENSE +0 -201
  347. data/THIRD_PARTY_LICENSES/swc_ecma_transforms_typescript-38.0.0/LICENSE +0 -201
  348. data/THIRD_PARTY_LICENSES/swc_ecma_usage_analyzer-27.0.0/LICENSE +0 -201
  349. data/THIRD_PARTY_LICENSES/swc_ecma_utils-25.0.0/LICENSE +0 -201
  350. data/THIRD_PARTY_LICENSES/swc_ecma_visit-19.0.0/LICENSE +0 -201
  351. data/THIRD_PARTY_LICENSES/swc_eq_ignore_macros-1.0.1/LICENSE +0 -201
  352. data/THIRD_PARTY_LICENSES/swc_error_reporters-20.0.0/LICENSE +0 -201
  353. data/THIRD_PARTY_LICENSES/swc_macros_common-1.0.1/LICENSE +0 -201
  354. data/THIRD_PARTY_LICENSES/swc_node_comments-18.0.0/LICENSE +0 -201
  355. data/THIRD_PARTY_LICENSES/swc_timer-1.0.0/LICENSE +0 -201
  356. data/THIRD_PARTY_LICENSES/swc_trace_macro-2.0.2/LICENSE +0 -201
  357. data/THIRD_PARTY_LICENSES/swc_transform_common-12.0.0/LICENSE +0 -201
  358. data/THIRD_PARTY_LICENSES/swc_visit-2.0.1/LICENSE +0 -201
  359. data/THIRD_PARTY_LICENSES/tap-1.0.1/LICENSE.txt +0 -21
  360. data/THIRD_PARTY_LICENSES/tracing-0.1.44/LICENSE +0 -25
  361. data/THIRD_PARTY_LICENSES/tracing-attributes-0.1.31/LICENSE +0 -25
  362. data/THIRD_PARTY_LICENSES/tracing-core-0.1.36/LICENSE +0 -25
  363. data/THIRD_PARTY_LICENSES/triomphe-0.1.15/LICENSE-APACHE +0 -201
  364. data/THIRD_PARTY_LICENSES/triomphe-0.1.15/LICENSE-MIT +0 -27
  365. data/THIRD_PARTY_LICENSES/unicode-width-0.1.14/LICENSE-APACHE +0 -201
  366. data/THIRD_PARTY_LICENSES/unicode-width-0.1.14/LICENSE-MIT +0 -25
  367. data/THIRD_PARTY_LICENSES/uuid-1.19.0/LICENSE-APACHE +0 -201
  368. data/THIRD_PARTY_LICENSES/uuid-1.19.0/LICENSE-MIT +0 -26
  369. data/THIRD_PARTY_LICENSES/vergen-9.0.6/LICENSE-APACHE +0 -201
  370. data/THIRD_PARTY_LICENSES/vergen-9.0.6/LICENSE-MIT +0 -25
  371. data/THIRD_PARTY_LICENSES/vergen-lib-0.1.6/LICENSE-APACHE +0 -201
  372. data/THIRD_PARTY_LICENSES/vergen-lib-0.1.6/LICENSE-MIT +0 -25
  373. data/THIRD_PARTY_LICENSES/wyz-0.5.1/LICENSE.txt +0 -21
  374. data/vendor/cfsolve/src/deobfuscate/analysis/globals.rs +0 -33
  375. data/vendor/cfsolve/src/deobfuscate/analysis/names.rs +0 -52
  376. data/vendor/cfsolve/src/listing/normalize.rs +0 -264
  377. data/vendor/cfsolve/src/stage2/analysis/outputs.rs +0 -327
  378. data/vendor/cfsolve/src/stage2/probes/stylesheets.rs +0 -249
  379. data/vendor/cfsolve/src/stage2/reference-expanded.json +0 -42
  380. data/vendor/cfsolve/src/stage2/session_names.rs +0 -470
  381. /data/THIRD_PARTY_LICENSES/{derive_builder-0.20.2 → cobs-0.3.0}/LICENSE-APACHE +0 -0
  382. /data/THIRD_PARTY_LICENSES/{compact_str-0.7.1 → compact_str-0.10.0}/LICENSE +0 -0
  383. /data/THIRD_PARTY_LICENSES/{ahash-0.8.12 → embedded-io-0.4.0}/LICENSE-APACHE +0 -0
  384. /data/THIRD_PARTY_LICENSES/{arrayvec-0.7.6 → embedded-io-0.6.1}/LICENSE-APACHE +0 -0
  385. /data/THIRD_PARTY_LICENSES/{normpath-0.2.0 → escape-simd-0.1.1}/LICENSE-APACHE +0 -0
  386. /data/THIRD_PARTY_LICENSES/{bstr-1.12.1 → itertools-0.15.0}/LICENSE-APACHE +0 -0
  387. /data/THIRD_PARTY_LICENSES/{petgraph-0.7.1 → itertools-0.15.0}/LICENSE-MIT +0 -0
  388. /data/THIRD_PARTY_LICENSES/{itoa-1.0.17 → itoa-1.0.19}/LICENSE-APACHE +0 -0
  389. /data/THIRD_PARTY_LICENSES/{camino-1.2.2 → itoa-1.0.19}/LICENSE-MIT +0 -0
  390. /data/THIRD_PARTY_LICENSES/{globset-0.4.18 → memchr-2.8.3}/COPYING +0 -0
  391. /data/THIRD_PARTY_LICENSES/{globset-0.4.18 → memchr-2.8.3}/LICENSE-MIT +0 -0
  392. /data/THIRD_PARTY_LICENSES/{camino-1.2.2 → num-bigint-0.5.1}/LICENSE-APACHE +0 -0
  393. /data/THIRD_PARTY_LICENSES/{swc_sourcemap-9.3.4 → oxc_sourcemap-9.0.0}/LICENSE +0 -0
  394. /data/THIRD_PARTY_LICENSES/{phf-0.11.3 → phf-0.14.0}/LICENSE +0 -0
  395. /data/THIRD_PARTY_LICENSES/{phf_generator-0.11.3 → phf_generator-0.14.0}/LICENSE +0 -0
  396. /data/THIRD_PARTY_LICENSES/{phf_macros-0.11.3 → phf_macros-0.14.0}/LICENSE +0 -0
  397. /data/THIRD_PARTY_LICENSES/{phf_shared-0.11.3 → phf_shared-0.14.0}/LICENSE +0 -0
  398. /data/THIRD_PARTY_LICENSES/{fixedbitset-0.5.7 → postcard-1.1.3}/LICENSE-APACHE +0 -0
  399. /data/THIRD_PARTY_LICENSES/{hashbrown-0.14.5 → smallvec-1.16.5}/LICENSE-APACHE +0 -0
  400. /data/THIRD_PARTY_LICENSES/{smallvec-1.15.1 → smallvec-1.16.5}/LICENSE-MIT +0 -0
  401. /data/THIRD_PARTY_LICENSES/{unicode-width-0.1.14 → unicode-segmentation-1.13.3}/COPYRIGHT +0 -0
  402. /data/THIRD_PARTY_LICENSES/{hashbrown-0.16.1 → unicode-segmentation-1.13.3}/LICENSE-APACHE +0 -0
  403. /data/THIRD_PARTY_LICENSES/{heck-0.5.0 → unicode-segmentation-1.13.3}/LICENSE-MIT +0 -0
  404. /data/THIRD_PARTY_LICENSES/{cargo-platform-0.1.9 → zmij_ecma-1.0.23}/LICENSE-MIT +0 -0
@@ -3,7 +3,7 @@
3
3
  use std::borrow::Cow;
4
4
  use std::rc::Rc;
5
5
 
6
- use swc_core::ecma::ast::BinaryOp;
6
+ use oxc::syntax::operator::BinaryOperator;
7
7
 
8
8
  use super::builtin::{self, Builtin};
9
9
  use super::run::{Evaluation, Run, Stop};
@@ -58,11 +58,31 @@ impl<'key> Key<'key, '_> {
58
58
  /// The key as property-name text (see [`semantics::property_key`]).
59
59
  pub(super) fn property(&self) -> Option<String> {
60
60
  match self {
61
- Self::Name(name) => Some(name.clone().into_owned()),
61
+ Self::Name(name) => Some(name.to_string()),
62
62
  Self::Value(value) => semantics::property_key(value),
63
63
  }
64
64
  }
65
65
 
66
+ /// Calls `visit` with the property-name text (see [`Self::property`]), without allocating
67
+ /// for names and small integers, the usual keys of object lookups.
68
+ fn with_property<R>(&self, visit: impl FnOnce(&str) -> R) -> Option<R> {
69
+ match self {
70
+ Self::Name(name) => Some(visit(name)),
71
+ // Integers below 10^15 are exact in i64 and print as plain digits; -0 prints as 0.
72
+ Self::Value(Value::Number(number)) if number.fract() == 0.0 && number.abs() < 1e15 => {
73
+ use std::io::Write;
74
+
75
+ let mut buffer = [0; 20];
76
+ let mut unwritten = &mut buffer[..];
77
+ write!(unwritten, "{}", *number as i64).expect("20 bytes hold any i64");
78
+ let length = 20 - unwritten.len();
79
+ let text = std::str::from_utf8(&buffer[..length]).expect("digits are ASCII");
80
+ Some(visit(text))
81
+ }
82
+ Self::Value(value) => semantics::property_key(value).map(|name| visit(&name)),
83
+ }
84
+ }
85
+
66
86
  fn expr(&self) -> Term {
67
87
  match self {
68
88
  Self::Name(name) => Term::Const(Constant::String(name.clone().into_owned())),
@@ -178,24 +198,21 @@ impl<'ast> Run<'ast, '_> {
178
198
  (None, Some(_)) => Value::Undefined,
179
199
  _ => return Err(unsupported("string member", key)),
180
200
  },
181
- Value::Object(properties) => {
182
- let name = key
183
- .property()
184
- .ok_or_else(|| unsupported("object key", key))?;
185
- properties
186
- .borrow()
187
- .iter()
188
- .find(|(key, _)| **key == *name)
189
- .map_or(Value::Undefined, |(_, value)| value.clone())
190
- }
191
- Value::Map(_) => match name.and_then(|name| builtin::method("Map.prototype", name)) {
192
- Some(method) => method,
193
- None => return Err(unsupported("map member", key)),
194
- },
195
- Value::Set(_) => match name.and_then(|name| builtin::method("Set.prototype", name)) {
196
- Some(method) => method,
197
- None => return Err(unsupported("set member", key)),
198
- },
201
+ Value::Object(properties) => key
202
+ .with_property(|name| {
203
+ properties
204
+ .borrow()
205
+ .iter()
206
+ .find(|(key, _)| key == name)
207
+ .map_or(Value::Undefined, |(_, value)| value.clone())
208
+ })
209
+ .ok_or_else(|| unsupported("object key", key))?,
210
+ Value::Map(_) => name
211
+ .and_then(|name| builtin::method("Map.prototype", name))
212
+ .ok_or_else(|| unsupported("map member", key))?,
213
+ Value::Set(_) => name
214
+ .and_then(|name| builtin::method("Set.prototype", name))
215
+ .ok_or_else(|| unsupported("set member", key))?,
199
216
  Value::Function(function) => match (&**function, name) {
200
217
  (_, Some("call")) => Value::function(Callable::Call(object.clone())),
201
218
  (_, Some("apply")) => Value::function(Callable::Apply(object.clone())),
@@ -211,10 +228,8 @@ impl<'ast> Run<'ast, '_> {
211
228
  _ => Value::symbolic(Term::Get(Box::new((**expr).clone()), Box::new(key.expr()))),
212
229
  },
213
230
  Value::Undefined | Value::Null => {
214
- let key = key.expr();
215
- return Err(Stop::throw(Value::string(&format!(
216
- "TypeError: reading {key}"
217
- ))));
231
+ let error = format!("TypeError: reading {}", key.expr());
232
+ return Err(Stop::throw(Value::string(&error)));
218
233
  }
219
234
  Value::Bool(_) | Value::Number(_) | Value::Symbol(_) => {
220
235
  return Err(unsupported("member of a primitive", key));
@@ -271,6 +286,7 @@ impl<'ast> Run<'ast, '_> {
271
286
  self.set_field(name.to_owned(), value);
272
287
  }
273
288
  Value::Array(elements) if key.text() == Some("length") => {
289
+ self.writable(object)?;
274
290
  match value.number() {
275
291
  Some(length) => {
276
292
  let length = convert::length(length)
@@ -294,6 +310,7 @@ impl<'ast> Run<'ast, '_> {
294
310
  .and_then(convert::length)
295
311
  .filter(|&index| index < MAXIMUM_LENGTH)
296
312
  .ok_or_else(|| unsupported("array index", key))?;
313
+ self.writable(object)?;
297
314
  let mut elements = elements.borrow_mut();
298
315
  if elements.len() <= index {
299
316
  elements.resize(index + 1, Value::Undefined);
@@ -301,16 +318,19 @@ impl<'ast> Run<'ast, '_> {
301
318
  elements[index] = value;
302
319
  }
303
320
  Value::Object(properties) => {
304
- let name = key
305
- .property()
321
+ let existing = key
322
+ .with_property(|name| {
323
+ properties
324
+ .borrow()
325
+ .iter()
326
+ .position(|(existing, _)| existing == name)
327
+ })
306
328
  .ok_or_else(|| unsupported("object key", key))?;
329
+ self.writable(object)?;
307
330
  let mut properties = properties.borrow_mut();
308
- match properties
309
- .iter_mut()
310
- .find(|(existing, _)| **existing == *name)
311
- {
312
- Some((_, slot)) => *slot = value,
313
- None => properties.push((name, value)),
331
+ match existing {
332
+ Some(index) => properties[index].1 = value,
333
+ None => properties.push((key.property().expect("the key has a name"), value)),
314
334
  }
315
335
  }
316
336
  Value::Symbolic(_) | Value::Namespace(_) => self.effects.push(Effect::SetProperty {
@@ -319,10 +339,8 @@ impl<'ast> Run<'ast, '_> {
319
339
  value: Box::new(value.expr()),
320
340
  }),
321
341
  Value::Undefined | Value::Null => {
322
- let key = key.expr();
323
- return Err(Stop::throw(Value::string(&format!(
324
- "TypeError: setting {key}"
325
- ))));
342
+ let error = format!("TypeError: setting {}", key.expr());
343
+ return Err(Stop::throw(Value::string(&error)));
326
344
  }
327
345
  _ => return Err(unsupported("setting a member", key)),
328
346
  }
@@ -348,33 +366,11 @@ impl<'ast> Run<'ast, '_> {
348
366
 
349
367
  /// Decrypts a string record using the same logic as the register file's `read` method.
350
368
  fn decrypted(&mut self, record: Value<'ast>) -> Evaluation<'ast, Value<'ast>> {
351
- let Value::Array(elements) = &record else {
352
- return Ok(record);
353
- };
354
- let field = |index: usize| elements.borrow().get(index).and_then(Value::number);
355
- let key = match (field(1), field(2), field(3)) {
356
- (Some(pc), Some(length), Some(key)) => Some((pc as u32, length as u32, key as u32)),
357
- _ => None,
358
- };
359
- if let Some(key) = key
360
- && let Some(text) = self.session.decrypted.borrow().get(&key)
361
- {
362
- return Ok(text.clone());
363
- }
364
369
  let decoder = self
365
370
  .session
366
371
  .record_decoder
367
- .as_ref()
368
372
  .ok_or_else(|| Stop::unsupported("an encrypted string with no decoder"))?;
369
- let decoder = self.lookup(decoder)?;
370
- let text = self.apply(decoder, Value::Undefined, vec![record])?;
371
- if let (Some(key), Value::String(_)) = (key, &text) {
372
- self.session
373
- .decrypted
374
- .borrow_mut()
375
- .insert(key, text.clone());
376
- }
377
- Ok(text)
373
+ self.script(decoder, None, Value::Undefined, vec![record])
378
374
  }
379
375
 
380
376
  /// A member of the register file (see [`Member`]).
@@ -410,27 +406,30 @@ impl<'ast> Run<'ast, '_> {
410
406
  /// Parses a canonical numeric property key so `a["0"]` matches `a[0]`. Noncanonical strings
411
407
  /// such as `"01"` and `"-0"` remain named properties.
412
408
  fn key_index(name: &str) -> Option<f64> {
413
- use swc_ecma_utils::number::ToJsString;
414
-
415
409
  // Most property keys are names rather than numeric strings.
416
410
  let first = name.bytes().next()?;
417
411
  if !(first.is_ascii_digit() || matches!(first, b'-' | b'I' | b'N')) {
418
412
  return None;
419
413
  }
420
414
  let number = js::string_number(name);
421
- (number.to_js_string() == name).then_some(number)
415
+ (semantics::number_text(number) == name).then_some(number)
422
416
  }
423
417
 
424
418
  /// Decodes `value` stored with `tag`, matching the value returned by the register reader.
425
419
  fn stored(tag: Stored, value: Value<'_>) -> Value<'_> {
426
420
  match tag {
427
- Stored::Integer(upper) => {
428
- semantics::binary_value(BinaryOp::BitXor, Value::Number(f64::from(upper)), value)
429
- }
421
+ Stored::Integer(upper) => semantics::binary_value(
422
+ BinaryOperator::BitwiseXOR,
423
+ Value::Number(f64::from(upper)),
424
+ value,
425
+ ),
430
426
  Stored::Boolean(upper) => {
431
- let bits =
432
- semantics::binary_value(BinaryOp::BitXor, value, Value::Number(f64::from(upper)));
433
- semantics::binary_value(BinaryOp::NotEqEq, bits, Value::Number(0.0))
427
+ let bits = semantics::binary_value(
428
+ BinaryOperator::BitwiseXOR,
429
+ value,
430
+ Value::Number(f64::from(upper)),
431
+ );
432
+ semantics::binary_value(BinaryOperator::StrictInequality, bits, Value::Number(0.0))
434
433
  }
435
434
  Stored::Plain | Stored::Record => value,
436
435
  }
@@ -3,8 +3,6 @@
3
3
  use std::cell::RefCell;
4
4
  use std::rc::Rc;
5
5
 
6
- use swc_ecma_utils::number::JsNumber;
7
-
8
6
  use super::access::Key;
9
7
  use super::run::{Evaluation, Run, Stop};
10
8
  use super::semantics;
@@ -216,17 +214,7 @@ impl<'ast> Run<'ast, '_> {
216
214
  let Value::Array(elements) = &this else {
217
215
  return self.apply(Value::symbolic(global()), this, arguments);
218
216
  };
219
- // Preserve [pc, key, cells, depth] frames for disassembly even when the
220
- // constructor-created stack is concrete. Other pushes need no symbolic effect.
221
- for value in &arguments {
222
- if let Value::Array(frame) = value
223
- && frame.borrow().len() == 4
224
- && let Term::Array(frame) = value.expr()
225
- && crate::vm::catch_frame(&frame).is_some()
226
- {
227
- self.temp(Term::Array(frame));
228
- }
229
- }
217
+ self.writable(&this)?;
230
218
  let mut elements = elements.borrow_mut();
231
219
  elements.extend(arguments);
232
220
  Ok(Value::Number(elements.len() as f64))
@@ -238,6 +226,7 @@ impl<'ast> Run<'ast, '_> {
238
226
  let Value::Array(elements) = &this else {
239
227
  return self.apply(Value::symbolic(global()), this, arguments);
240
228
  };
229
+ self.writable(&this)?;
241
230
  let popped = elements.borrow_mut().pop();
242
231
  match popped {
243
232
  Some(value) => Ok(value),
@@ -255,9 +244,7 @@ impl<'ast> Run<'ast, '_> {
255
244
  Builtin::Pow => {
256
245
  let values = numbers()?;
257
246
  let value = |index: usize| values.get(index).copied().unwrap_or(f64::NAN);
258
- Ok(Value::Number(
259
- *JsNumber::from(value(0)).pow(value(1).into()),
260
- ))
247
+ Ok(Value::Number(semantics::exponentiate(value(0), value(1))))
261
248
  }
262
249
  Builtin::Floor => {
263
250
  let value = numbers()?.first().copied().unwrap_or(f64::NAN);
@@ -377,11 +364,13 @@ impl<'ast> Run<'ast, '_> {
377
364
  },
378
365
  Builtin::Add => {
379
366
  if contains(&members.borrow(), &key) == Some(false) {
367
+ self.writable(&this)?;
380
368
  members.borrow_mut().push(key);
381
369
  }
382
370
  Ok(this.clone())
383
371
  }
384
372
  _ => {
373
+ self.writable(&this)?;
385
374
  let mut members = members.borrow_mut();
386
375
  let before = members.len();
387
376
  members.retain(|member| {
@@ -414,6 +403,7 @@ impl<'ast> Run<'ast, '_> {
414
403
  Builtin::MapHas => Ok(Value::Bool(position.is_some())),
415
404
  Builtin::MapSet => {
416
405
  let value = argument(1);
406
+ self.writable(&this)?;
417
407
  let mut entries = entries.borrow_mut();
418
408
  match position {
419
409
  Some(position) => entries[position].1 = value,
@@ -423,6 +413,7 @@ impl<'ast> Run<'ast, '_> {
423
413
  }
424
414
  _ => {
425
415
  if let Some(position) = position {
416
+ self.writable(&this)?;
426
417
  entries.borrow_mut().remove(position);
427
418
  }
428
419
  Ok(Value::Bool(position.is_some()))
@@ -578,10 +569,11 @@ const STATIC_FUNCTIONS: &[&str] = &[
578
569
 
579
570
  #[cfg(test)]
580
571
  mod tests {
581
- use swc_core::ecma::ast::BinaryOp;
572
+ use oxc::syntax::operator::BinaryOperator;
582
573
 
583
574
  use super::super::{Run, semantics};
584
575
  use super::*;
576
+ use crate::js::ast::ParsedScript;
585
577
  use crate::vm::session::Session;
586
578
 
587
579
  fn number(value: Evaluation<'_, Value<'_>>) -> f64 {
@@ -593,7 +585,8 @@ mod tests {
593
585
 
594
586
  #[test]
595
587
  fn math_follows_javascript() {
596
- let session = Session::empty();
588
+ let parsed = ParsedScript::parse("t", "").expect("an empty script parses");
589
+ let session = Session::empty(parsed.script());
597
590
  let mut run = Run::method(&session);
598
591
  let mut call = |builtin, arguments: &[f64]| {
599
592
  let arguments = arguments.iter().copied().map(Value::Number).collect();
@@ -608,53 +601,12 @@ mod tests {
608
601
  assert!(call(Builtin::Floor, &[]).is_nan());
609
602
  }
610
603
 
611
- #[test]
612
- fn concrete_stack_pushes_expose_exception_frames_to_disassembly() {
613
- let session = Session::empty();
614
- let mut run = Run::method(&session);
615
- let stack = Value::array(vec![]);
616
- let frame = Value::array(vec![
617
- Value::Number(42.0),
618
- Value::Number(7.0),
619
- Value::Cells,
620
- Value::Number(0.0),
621
- ]);
622
- let expected = frame.expr();
623
- assert_eq!(
624
- number(run.builtin(Builtin::Push, stack.clone(), vec![frame])),
625
- 1.0
626
- );
627
- assert_eq!(
628
- run.effects,
629
- vec![crate::vm::Effect::Let(0, expected.clone())]
630
- );
631
- assert_eq!(stack.expr(), Term::Array(vec![expected]));
632
- for (length, value) in [
633
- (2.0, Value::Number(9.0)),
634
- (3.0, Value::array(vec![Value::Number(42.0)])),
635
- (
636
- 4.0,
637
- Value::array(vec![
638
- Value::Number(42.0),
639
- Value::Number(256.0),
640
- Value::Cells,
641
- Value::Number(0.0),
642
- ]),
643
- ),
644
- ] {
645
- assert_eq!(
646
- number(run.builtin(Builtin::Push, stack.clone(), vec![value])),
647
- length
648
- );
649
- assert_eq!(run.effects.len(), 1);
650
- }
651
- }
652
-
653
604
  /// Checks `SameValueZero` membership: the set contains 1, "1", NaN, and 0 after duplicate
654
605
  /// removal.
655
606
  #[test]
656
607
  fn a_set_keeps_each_member_once() {
657
- let session = Session::empty();
608
+ let parsed = ParsedScript::parse("t", "").expect("an empty script parses");
609
+ let session = Session::empty(parsed.script());
658
610
  let mut run = Run::method(&session);
659
611
  let source = [1.0, 1.0, f64::NAN, f64::NAN, 0.0, -0.0].map(Value::Number);
660
612
  let mut source = source.to_vec();
@@ -723,7 +675,8 @@ mod tests {
723
675
  /// `charCodeAt` operate on code units, and a string with a lone surrogate prints as units.
724
676
  #[test]
725
677
  fn strings_are_code_units() {
726
- let session = Session::empty();
678
+ let parsed = ParsedScript::parse("t", "").expect("an empty script parses");
679
+ let session = Session::empty(parsed.script());
727
680
  let mut run = Run::method(&session);
728
681
  let mut call = |builtin: Builtin, this, arguments| {
729
682
  let Ok(value) = run.builtin(builtin, this, arguments) else {
@@ -754,7 +707,7 @@ mod tests {
754
707
  });
755
708
  let sum = halves
756
709
  .into_iter()
757
- .reduce(|left, right| semantics::binary_value(BinaryOp::Add, left, right))
710
+ .reduce(|left, right| semantics::binary_value(BinaryOperator::Addition, left, right))
758
711
  .expect("there are four halves");
759
712
  for string in [joined, sum] {
760
713
  let text = semantics::text(&string).and_then(|text| text.text());