Backed out 1 changesets (bug 1410132) for asserting /builds/worker/workspace/build/src/memory/build/mozjemalloc.cpp:4729 r=backout on a CLOSED TREE

Backed out changeset fc7fdeed66bc (bug 1410132)
This commit is contained in:
NARCIS BELEUZU 2017-11-03 15:17:24 +02:00
parent 236241b82c
commit 4f24ca320e
11 changed files with 21 additions and 85 deletions

View File

@ -69,7 +69,6 @@ included_inclnames_to_ignore = set([
'jscustomallocator.h', # provided by embedders; allowed to be missing
'js-config.h', # generated in $OBJDIR
'fdlibm.h', # fdlibm
'mozmemory.h', # included without a path
'pratom.h', # NSPR
'prcvar.h', # NSPR
'prerror.h', # NSPR

View File

@ -26,8 +26,6 @@
#include "jstypes.h"
#include "mozmemory.h"
/* The public JS engine namespace. */
namespace JS {}
@ -366,33 +364,22 @@ struct MOZ_RAII JS_PUBLIC_DATA(AutoEnterOOMUnsafeRegion)
} /* namespace js */
// Malloc allocation.
namespace js {
extern JS_PUBLIC_DATA(arena_id_t) MallocArena;
extern void InitMallocAllocator();
extern void ShutDownMallocAllocator();
} /* namespace js */
static inline void* js_malloc(size_t bytes)
{
JS_OOM_POSSIBLY_FAIL();
return moz_arena_malloc(js::MallocArena, bytes);
return malloc(bytes);
}
static inline void* js_calloc(size_t bytes)
{
JS_OOM_POSSIBLY_FAIL();
return moz_arena_calloc(js::MallocArena, bytes, 1);
return calloc(bytes, 1);
}
static inline void* js_calloc(size_t nmemb, size_t size)
{
JS_OOM_POSSIBLY_FAIL();
return moz_arena_calloc(js::MallocArena, nmemb, size);
return calloc(nmemb, size);
}
static inline void* js_realloc(void* p, size_t bytes)
@ -403,18 +390,19 @@ static inline void* js_realloc(void* p, size_t bytes)
MOZ_ASSERT(bytes != 0);
JS_OOM_POSSIBLY_FAIL();
return moz_arena_realloc(js::MallocArena, p, bytes);
return realloc(p, bytes);
}
static inline void js_free(void* p)
{
// TODO: This should call |moz_arena_free(js::MallocArena, p)| but we
// currently can't enforce that all memory freed here was allocated by
// js_malloc().
free(p);
}
JS_PUBLIC_API(char*) js_strdup(const char* s);
static inline char* js_strdup(const char* s)
{
JS_OOM_POSSIBLY_FAIL();
return strdup(s);
}
#endif/* JS_USE_CUSTOM_ALLOCATOR */
#include <new>

View File

@ -394,13 +394,12 @@ END_TEST(testHashMapLookupWithDefaultOOM)
BEGIN_TEST(testHashTableMovableEnum)
{
IntSet set;
CHECK(set.init());
// Exercise returning a hash table Enum object from a function.
CHECK(set.put(1));
for (auto e = enumerateSet(set); !e.empty(); e.popFront())
for (auto e = enumerateSet(); !e.empty(); e.popFront())
e.removeFront();
CHECK(set.count() == 0);
@ -426,7 +425,9 @@ BEGIN_TEST(testHashTableMovableEnum)
return true;
}
IntSet::Enum enumerateSet(IntSet& set)
IntSet set;
IntSet::Enum enumerateSet()
{
return IntSet::Enum(set);
}

View File

@ -45,7 +45,6 @@ void JSAPITest::uninit()
destroyContext();
cx = nullptr;
}
msgs.clear();
}
bool JSAPITest::exec(const char* bytes, const char* filename, int lineno)

View File

@ -33,7 +33,6 @@ class JSAPITestString {
const char* begin() const { return chars.begin(); }
const char* end() const { return chars.end(); }
size_t length() const { return chars.length(); }
void clear() { chars.clearAndFree(); }
JSAPITestString& operator +=(const char* s) {
if (!chars.append(s, strlen(s)))

View File

@ -3868,12 +3868,7 @@ js::DuplicateString(JSContext* cx, const char16_t* s)
UniqueChars
js::DuplicateString(const char* s)
{
size_t n = strlen(s) + 1;
UniqueChars ret(js_pod_malloc<char>(n));
if (!ret)
return ret;
PodCopy(ret.get(), s, n);
return ret;
return UniqueChars(js_strdup(s));
}
UniqueChars
@ -3904,12 +3899,6 @@ js::DuplicateString(const char16_t* s, size_t n)
return ret;
}
JS_PUBLIC_API(char*)
js_strdup(const char* s)
{
return DuplicateString(s).release();
}
template <typename CharT>
const CharT*
js_strchr_limit(const CharT* s, char16_t c, const CharT* limit)

View File

@ -170,20 +170,6 @@ ResetSimulatedInterrupt()
} // namespace js
#endif // defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
JS_PUBLIC_DATA(arena_id_t) js::MallocArena;
void
js::InitMallocAllocator()
{
MallocArena = moz_create_arena();
}
void
js::ShutDownMallocAllocator()
{
moz_dispose_arena(MallocArena);
}
JS_PUBLIC_API(void)
JS_Assert(const char* s, const char* file, int ln)
{

View File

@ -3992,8 +3992,6 @@ KillWorkerThreads(JSContext* cx)
thread->join();
}
workerThreads.clearAndFree();
js_delete(workerThreadsLock);
workerThreadsLock = nullptr;
@ -4929,12 +4927,12 @@ NestedShell(JSContext* cx, unsigned argc, Value* vp)
JS_ReportErrorNumberASCII(cx, my_GetErrorMessage, nullptr, JSSMSG_NESTED_FAIL);
return false;
}
if (!argv.append(js_strdup(sArgv[0])))
if (!argv.append(strdup(sArgv[0])))
return false;
// Propagate selected flags from the current shell
for (unsigned i = 0; i < sPropagatedFlags.length(); i++) {
char* cstr = js_strdup(sPropagatedFlags[i]);
char* cstr = strdup(sPropagatedFlags[i]);
if (!cstr || !argv.append(cstr))
return false;
}
@ -5755,7 +5753,6 @@ ShutdownBufferStreams()
state->shutdown = true;
while (!state->jobs.empty())
state.wait(/* jobs empty */);
state->jobs.clearAndFree();
}
static bool
@ -8655,12 +8652,6 @@ main(int argc, char** argv, char** envp)
SetOutputFile("JS_STDOUT", &rcStdout, &gOutFile);
SetOutputFile("JS_STDERR", &rcStderr, &gErrFile);
// Start the engine.
if (!JS_Init())
return 1;
auto shutdownEngine = MakeScopeExit([]() { JS_ShutDown(); });
OptionParser op("Usage: {progname} [options] [[script] scriptArgs*]");
op.setDescription("The SpiderMonkey shell provides a command line interface to the "
@ -8884,6 +8875,10 @@ main(int argc, char** argv, char** envp)
if (op.getBoolOption("no-threads"))
js::DisableExtraThreads();
// Start the engine.
if (!JS_Init())
return 1;
if (!InitSharedArrayBufferMailbox())
return 1;
@ -8984,5 +8979,6 @@ main(int argc, char** argv, char** envp)
DestructSharedArrayBufferMailbox();
JS_DestroyContext(cx);
JS_ShutDown();
return result;
}

View File

@ -100,8 +100,6 @@ JS::detail::InitWithFailureDiagnostic(bool isDebugBuild)
RETURN_IF_FAIL(js::oom::InitThreadType());
#endif
js::InitMallocAllocator();
RETURN_IF_FAIL(js::Mutex::Init());
RETURN_IF_FAIL(js::wasm::InitInstanceStaticData());
@ -172,7 +170,6 @@ JS_ShutDown(void)
js::MemoryProtectionExceptionHandler::uninstall();
js::wasm::ShutDownInstanceStaticData();
js::wasm::ShutDownProcessStaticData();
js::Mutex::ShutDown();
@ -202,8 +199,6 @@ JS_ShutDown(void)
js::jit::ReleaseProcessExecutableMemory();
}
js::ShutDownMallocAllocator();
libraryInitState = InitState::ShutDown;
}

View File

@ -126,13 +126,6 @@ class ProcessCodeSegmentMap
MOZ_ASSERT(segments2_.empty());
}
void freeAll() {
MOZ_ASSERT(segments1_.empty());
MOZ_ASSERT(segments2_.empty());
segments1_.clearAndFree();
segments2_.clearAndFree();
}
bool insert(const CodeSegment* cs) {
LockGuard<Mutex> lock(mutatorsMutex_);
@ -237,9 +230,3 @@ wasm::LookupCode(const void* pc)
const CodeSegment* found = LookupCodeSegment(pc);
return found ? found->code() : nullptr;
}
void
wasm::ShutDownProcessStaticData()
{
processCodeSegmentMap.freeAll();
}

View File

@ -51,9 +51,6 @@ RegisterCodeSegment(const CodeSegment* cs);
void
UnregisterCodeSegment(const CodeSegment* cs);
void
ShutDownProcessStaticData();
} // namespace wasm
} // namespace js