Skip to content

Commit be873b8

Browse files
authored
Tweak condition for TEXTDECODER=2 default (#24349)
- When using pthreads, our `TextDecoder` usage already correctly handles shared memory through the `getUnsharedTextDecoderView` helper, so the check and the comment are outdated. - When targeting Audio Worklets, we already have assertion that TEXTDECODER!=2 as it's not compatible with that environment, so opt-out from the size optimisation there instead.
1 parent 5257542 commit be873b8

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3988
1+
3795
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8264
1+
7883

tools/link.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,11 +1008,12 @@ def limit_incoming_module_api():
10081008

10091009
# Default to TEXTDECODER=2 (always use TextDecoder to decode UTF-8 strings)
10101010
# in -Oz builds, since custom decoder for UTF-8 takes up space.
1011-
# In pthreads enabled builds, TEXTDECODER==2 may not work, see
1012-
# https://github.com/whatwg/encoding/issues/172
10131011
# When supporting shell environments, do not do this as TextDecoder is not
10141012
# widely supported there.
1015-
if settings.SHRINK_LEVEL >= 2 and not settings.SHARED_MEMORY and \
1013+
# In Audio Worklets TextDecoder API is intentionally not exposed
1014+
# (https://github.com/WebAudio/web-audio-api/issues/2499) so we also need to
1015+
# keep the JavaScript-based fallback.
1016+
if settings.SHRINK_LEVEL >= 2 and not settings.AUDIO_WORKLET and \
10161017
not settings.ENVIRONMENT_MAY_BE_SHELL:
10171018
default_setting('TEXTDECODER', 2)
10181019

0 commit comments

Comments
 (0)