Преглед изворни кода

LibJS/JIT: Make generating GDB images opt-in

Since generating GDB image can be expensive, it is disabled by default
and can be activated by setting the `LIBJS_JIT_GDB` environment
variable.
Jesús (gsus) Lapastora пре 1 година
родитељ
комит
706710fa13
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      Userland/Libraries/LibJS/JIT/Compiler.cpp

+ 6 - 1
Userland/Libraries/LibJS/JIT/Compiler.cpp

@@ -6,6 +6,7 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <AK/FixedArray.h>
 #include <AK/OwnPtr.h>
 #include <AK/Platform.h>
 #include <LibJIT/GDB.h>
@@ -3764,7 +3765,11 @@ OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable& bytecode_execut
         compiler.m_output.size(),
     };
 
-    auto gdb_object = ::JIT::GDB::build_gdb_image(code, "LibJS JIT"sv, "LibJS JITted code"sv);
+    Optional<FixedArray<u8>> gdb_object {};
+
+    if (getenv("LIBJS_JIT_GDB")) {
+        gdb_object = ::JIT::GDB::build_gdb_image(code, "LibJS JIT"sv, "LibJS JITted code"sv);
+    }
 
     auto executable = make<NativeExecutable>(executable_memory, compiler.m_output.size(), mapping, move(gdb_object));
     if constexpr (DUMP_JIT_DISASSEMBLY)