Skip to content

Commit

Permalink
AK: Remove unused STRINGIMPL_DEBUG instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed May 14, 2021
1 parent 5fd65ad commit d039542
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 31 deletions.
4 changes: 0 additions & 4 deletions AK/Debug.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,6 @@
#cmakedefine01 SQL_DEBUG
#endif

#ifndef STRINGIMPL_DEBUG
#cmakedefine01 STRINGIMPL_DEBUG
#endif

#ifndef SYNTAX_HIGHLIGHTING_DEBUG
#cmakedefine01 SYNTAX_HIGHLIGHTING_DEBUG
#endif
Expand Down
26 changes: 0 additions & 26 deletions AK/StringImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,13 @@
* SPDX-License-Identifier: BSD-2-Clause
*/

#include <AK/Debug.h>
#include <AK/FlyString.h>
#include <AK/Memory.h>
#include <AK/StdLibExtras.h>
#include <AK/StringHash.h>
#include <AK/StringImpl.h>
#include <AK/kmalloc.h>

#if STRINGIMPL_DEBUG
unsigned g_stringimpl_count;
static HashTable<StringImpl*>* g_all_live_stringimpls;

void dump_all_stringimpls();
void dump_all_stringimpls()
{
unsigned i = 0;
for (auto& it : *g_all_live_stringimpls) {
dbgln("{}: \"{}\"", i, *it);
++i;
}
}
#endif

namespace AK {

static StringImpl* s_the_empty_stringimpl = nullptr;
Expand All @@ -43,22 +27,12 @@ StringImpl& StringImpl::the_empty_stringimpl()
StringImpl::StringImpl(ConstructWithInlineBufferTag, size_t length)
: m_length(length)
{
#if STRINGIMPL_DEBUG
if (!g_all_live_stringimpls)
g_all_live_stringimpls = new HashTable<StringImpl*>;
++g_stringimpl_count;
g_all_live_stringimpls->set(this);
#endif
}

StringImpl::~StringImpl()
{
if (m_fly)
FlyString::did_destroy_impl({}, *this);
#if STRINGIMPL_DEBUG
--g_stringimpl_count;
g_all_live_stringimpls->remove(this);
#endif
}

static inline size_t allocation_size_for_stringimpl(size_t length)
Expand Down
1 change: 0 additions & 1 deletion Meta/CMake/all_the_debug_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ set(DIFF_DEBUG ON)
set(HIGHLIGHT_FOCUSED_FRAME_DEBUG ON)
set(ITEM_RECTS_DEBUG ON)
set(SH_LANGUAGE_SERVER_DEBUG ON)
set(STRINGIMPL_DEBUG ON)
set(TEXTEDITOR_DEBUG ON)
set(DEFERRED_INVOKE_DEBUG ON)
set(DYNAMIC_LOAD_DEBUG ON)
Expand Down

0 comments on commit d039542

Please sign in to comment.