tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit f80645835e96f46879a82285fe18b2b7f0602b21
parent 4e8b34277213cda72180f85f745d3ca4d82b1252
Author: Rong "Mantle" Bao <webmaster@csmantle.top>
Date:   Tue, 11 Nov 2025 15:22:23 +0000

Bug 1999478 - [riscv64] Hide DEBUG_PRINTF behind a gate to avoid codegen on non-DEBUG builds. r=jandem

The shrink in binary size proves the effect of this change, which also
reveals that the original code and its associated format strings are not
eliminated as dead.

After:

        $ size ./obj/dist/bin/js
           text    data     bss     dec     hex filename
        77153608        3045625 10363484        90562717        565e09d ./obj/dist/bin/js

Before:

        $ size ./obj/dist/bin/js
           text    data     bss     dec     hex filename
        77166598        3050169 10362748        90579515        566223b ./obj/dist/bin/js

Differential Revision: https://phabricator.services.mozilla.com/D272128

Diffstat:
Mjs/src/jit/riscv64/extension/base-assembler-riscv.h | 16++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/js/src/jit/riscv64/extension/base-assembler-riscv.h b/js/src/jit/riscv64/extension/base-assembler-riscv.h @@ -91,10 +91,18 @@ namespace jit { typedef FloatRegister FPURegister; #define zero_reg zero -#define DEBUG_PRINTF(...) \ - if (FLAG_riscv_debug) { \ - std::printf(__VA_ARGS__); \ - } +#if defined(DEBUG) +// Only useful when defined(DEBUG). See op.getBoolOption("riscv-debug") in +// js/src/shell/js.cpp. +# define DEBUG_PRINTF(...) \ + if (FLAG_riscv_debug) { \ + std::printf(__VA_ARGS__); \ + } +#else +# define DEBUG_PRINTF(...) \ + do { \ + } while (0) +#endif /* defined(DEBUG) */ int ToNumber(Register reg); Register ToRegister(uint32_t num);