From 0d9a5a169f8bfe6ae1924e7c0fdadc250a13eab0 Mon Sep 17 00:00:00 2001 From: Tzvetan Mikov Date: Sat, 11 Apr 2020 10:53:41 -0700 Subject: [PATCH] Enable the debugger by default in host builds Summary: Always enable the Hermes debugger in host builds to decrease the number of supported configurations. Reviewed By: willholen Differential Revision: D20969039 fbshipit-source-id: 2ab5cb3aa5abf911ae60d20f0b8eb30bc04a3b3a --- CMakeLists.txt | 19 ++++++++++++------- lib/InternalBytecode/CMakeLists.txt | 8 +------- lib/VM/Profiler/InlineCacheProfiler.cpp | 3 ++- unittests/VMRuntime/HeapSnapshotTest.cpp | 3 ++- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fd0c33438d..f675c95f87a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,13 @@ include(Lit) set(HERMES_RELEASE_VERSION ${PROJECT_VERSION}${VERSION_SUFFIX}) # Project options. + +set(HERMES_IS_ANDROID OFF CACHE BOOL + "Building for Android") + +set(HERMES_IS_MOBILE_BUILD ${HERMES_IS_ANDROID} CACHE BOOL + "Building for a mobile device") + set(HERMESVM_GCKIND NONCONTIG_GENERATIONAL CACHE STRING "HermesVM GC type: either NONCONTIG_GENERATIONAL or MALLOC") @@ -119,7 +126,11 @@ set(HERMES_SLOW_DEBUG ON CACHE BOOL set(HERMES_STATIC_LINK OFF CACHE BOOL "Link Hermes statically. May only work on GNU/Linux.") -set(HERMES_ENABLE_DEBUGGER OFF CACHE BOOL +set(HERMES_ENABLE_DEBUGGER_DEFAULT OFF) +if (NOT HERMES_IS_MOBILE_BUILD) + set(HERMES_ENABLE_DEBUGGER_DEFAULT ON) +endif() +set(HERMES_ENABLE_DEBUGGER ${HERMES_ENABLE_DEBUGGER_DEFAULT} CACHE BOOL "Build with debugger support") set(HERMES_ENABLE_IR_INSTRUMENTATION OFF CACHE BOOL @@ -146,12 +157,6 @@ set(HERMESVM_JIT_DISASSEMBLER OFF CACHE BOOL set(HERMES_USE_FLOWPARSER OFF CACHE BOOL "Use libflowparser for parsing es6") -set(HERMES_IS_MOBILE_BUILD OFF CACHE BOOL - "Building for a mobile device") - -set(HERMES_IS_ANDROID OFF CACHE BOOL - "Building for Android") - set(HERMES_ENABLE_WERROR OFF CACHE BOOL "Whether the build should have -Werror enabled") diff --git a/lib/InternalBytecode/CMakeLists.txt b/lib/InternalBytecode/CMakeLists.txt index f0105442f8d..fc52c0d3b2f 100644 --- a/lib/InternalBytecode/CMakeLists.txt +++ b/lib/InternalBytecode/CMakeLists.txt @@ -18,13 +18,7 @@ add_hermes_library(hermesInternalBytecode InternalBytecode.cpp ) -# Only enable optimized libraries if the Hermes debugger isn't on. -# This allows the user to debug the JS libraries. -if(HERMES_ENABLE_DEBUGGER) - set(JS_COMPILER_FLAGS "") -else() - set(JS_COMPILER_FLAGS "-O") -endif() +set(JS_COMPILER_FLAGS "-O") # Concatenate all JS files into one source file for compilation. # This way there is only one RuntimeModule made for them. diff --git a/lib/VM/Profiler/InlineCacheProfiler.cpp b/lib/VM/Profiler/InlineCacheProfiler.cpp index 6ffd72057b0..beaa5e20ea5 100644 --- a/lib/VM/Profiler/InlineCacheProfiler.cpp +++ b/lib/VM/Profiler/InlineCacheProfiler.cpp @@ -8,6 +8,7 @@ #ifdef HERMESVM_PROFILER_BB #ifndef INLINECACHE_PROFILER_H #include "hermes/VM/Profiler/InlineCacheProfiler.h" +#include "hermes/Support/Algorithms.h" #include "hermes/VM/CodeBlock.h" #include "hermes/VM/Handle.h" #include "hermes/VM/HiddenClass.h" @@ -116,7 +117,7 @@ void InlineCacheProfiler::dumpHiddenClassProperties( std::unique_ptr InlineCacheProfiler::getRankedInlineCachingMisses() { std::unique_ptr icInfoList = - std::make_unique(); + hermes::make_unique(); // rank inline caching miss information for (auto itr = cacheMisses_.begin(); itr != cacheMisses_.end(); ++itr) { icInfoList->push_back(*itr); diff --git a/unittests/VMRuntime/HeapSnapshotTest.cpp b/unittests/VMRuntime/HeapSnapshotTest.cpp index f43d259238f..af5c7ccc267 100644 --- a/unittests/VMRuntime/HeapSnapshotTest.cpp +++ b/unittests/VMRuntime/HeapSnapshotTest.cpp @@ -9,6 +9,7 @@ #include "TestHelpers.h" #include "gtest/gtest.h" #include "hermes/Parser/JSONParser.h" +#include "hermes/Support/Algorithms.h" #include "hermes/Support/Allocator.h" #include "hermes/VM/CellKind.h" #include "hermes/VM/GC.h" @@ -788,7 +789,7 @@ struct ChromeStackTreeNode { llvm::cast(traceNodes[i + 1])->getValue(); auto children = llvm::cast(traceNodes[i + 4]); auto treeNode = - std::make_unique(parent, functionInfoIndex); + hermes::make_unique(parent, functionInfoIndex); idNodeMap.emplace(id, treeNode.get()); treeNode->children_ = parse(*children, treeNode.get(), idNodeMap); res.emplace_back(std::move(treeNode));