Bug 725230 - Enable and fix assertions in linker code. r=tglek

This commit is contained in:
Mike Hommey 2012-02-13 15:49:45 +01:00
parent 818458fdc8
commit c1b6200e80
6 changed files with 17 additions and 23 deletions

View File

@ -81,6 +81,8 @@ enum StartupEvent {
#undef mozilla_StartupTimeline_Event
};
using namespace mozilla;
static uint64_t *sStartupTimeline;
void StartupTimeline_Record(StartupEvent ev, struct timeval *tm)
@ -651,7 +653,7 @@ loadGeckoLibs(const char *apkName)
struct rusage usage1;
getrusage(RUSAGE_THREAD, &usage1);
Zip *zip = new Zip(apkName);
RefPtr<Zip> zip = new Zip(apkName);
#ifdef MOZ_CRASHREPORTER
file_ids = (char *)extractBuf("lib.id", zip);
@ -682,8 +684,6 @@ loadGeckoLibs(const char *apkName)
#undef MOZLOAD
#endif
delete zip;
#ifdef MOZ_CRASHREPORTER
free(file_ids);
file_ids = NULL;
@ -749,7 +749,7 @@ static void loadSQLiteLibs(const char *apkName)
apk_mtime = status.st_mtime;
#endif
Zip *zip = new Zip(apkName);
RefPtr<Zip> zip = new Zip(apkName);
lib_mapping = (struct mapping_info *)calloc(MAX_MAPPING_INFO, sizeof(*lib_mapping));
#ifdef MOZ_CRASHREPORTER
@ -767,8 +767,6 @@ static void loadSQLiteLibs(const char *apkName)
#undef MOZLOAD
#endif
delete zip;
#ifdef MOZ_CRASHREPORTER
free(file_ids);
file_ids = NULL;

View File

@ -318,7 +318,6 @@ ElfLoader::~ElfLoader()
debug("ElfLoader::~ElfLoader(): Remaining handle for \"%s\" "
"[%d direct refs, %d refs total]", (*it)->GetPath(),
(*it)->DirectRefCount(), (*it)->refCount());
delete (*it);
} else {
debug("ElfLoader::~ElfLoader(): Unexpected remaining handle for \"%s\" "
"[%d direct refs, %d refs total]", (*it)->GetPath(),

View File

@ -7,8 +7,6 @@
#include <vector>
#include <dlfcn.h>
/* Until RefPtr.h stops using JS_Assert */
#undef DEBUG
#include "mozilla/RefPtr.h"
#include "Zip.h"
@ -98,7 +96,7 @@ public:
{
bool ret = false;
if (directRefCnt) {
// ASSERT(directRefCnt >= mozilla::RefCounted<LibHandle>::refCount())
MOZ_ASSERT(directRefCnt <= mozilla::RefCounted<LibHandle>::refCount());
if (--directRefCnt)
ret = true;
mozilla::RefCounted<LibHandle>::Release();

View File

@ -35,8 +35,8 @@ void *
MappableFile::mmap(const void *addr, size_t length, int prot, int flags,
off_t offset)
{
// ASSERT(fd != -1)
// ASSERT(! flags & MAP_SHARED)
MOZ_ASSERT(fd != -1);
MOZ_ASSERT(!(flags & MAP_SHARED));
flags |= MAP_PRIVATE;
void *mapped = ::mmap(const_cast<void *>(addr), length, prot, flags,
@ -191,7 +191,7 @@ public:
void *mmap(const void *addr, size_t length, int prot, int flags, off_t offset)
{
// ASSERT(fd != -1)
MOZ_ASSERT(fd != -1);
#ifdef ANDROID
/* Mapping ashmem MAP_PRIVATE is like mapping anonymous memory, even when
* there is content in the ashmem */
@ -222,7 +222,7 @@ private:
MappableDeflate *
MappableDeflate::Create(const char *name, Zip *zip, Zip::Stream *stream)
{
// ASSERT(stream->GetType() == Zip::Stream::DEFLATE)
MOZ_ASSERT(stream->GetType() == Zip::Stream::DEFLATE);
_MappableBuffer *buf = _MappableBuffer::Create(name, stream->GetUncompressedSize());
if (buf)
return new MappableDeflate(buf, zip, stream);
@ -238,8 +238,8 @@ MappableDeflate::~MappableDeflate() { }
void *
MappableDeflate::mmap(const void *addr, size_t length, int prot, int flags, off_t offset)
{
// ASSERT(buffer)
// ASSERT(! flags & MAP_SHARED)
MOZ_ASSERT(buffer);
MOZ_ASSERT(!(flags & MAP_SHARED));
flags |= MAP_PRIVATE;
/* The deflate stream is uncompressed up to the required offset + length, if

View File

@ -9,6 +9,7 @@
#include <stddef.h>
#include <sys/mman.h>
#include <unistd.h>
#include "mozilla/Assertions.h"
/**
* On architectures that are little endian and that support unaligned reads,
@ -280,7 +281,7 @@ public:
void Init(const void *buf)
{
// ASSERT(operator bool())
MOZ_ASSERT(contents == NULL);
contents = reinterpret_cast<const T *>(buf);
}
@ -289,7 +290,7 @@ public:
*/
const T &operator[](const idx_t index) const
{
// ASSERT(operator bool())
MOZ_ASSERT(contents);
return contents[index];
}
@ -346,7 +347,7 @@ public:
void Init(const idx_t len)
{
// ASSERT(length != 0)
MOZ_ASSERT(length == 0);
length = len;
}
@ -372,8 +373,8 @@ public:
*/
const T &operator[](const idx_t index) const
{
// ASSERT(index < length)
// ASSERT(operator bool())
MOZ_ASSERT(index < length);
MOZ_ASSERT(operator bool());
return UnsizedArray<T>::operator[](index);
}

View File

@ -10,8 +10,6 @@
#include <vector>
#include <zlib.h>
#include "Utils.h"
/* Until RefPtr.h stops using JS_Assert */
#undef DEBUG
#include "mozilla/RefPtr.h"
/**