Backout 8eef38643ceb (bug 717540) and 78941a969e20 (bug 725230) because of windows debug bustage

This commit is contained in:
Mike Hommey 2012-02-13 16:35:13 +01:00
parent ecd0fb5a52
commit de636eb93e
27 changed files with 105 additions and 195 deletions

View File

@ -256,9 +256,7 @@ endif
endif # WINNT && !GNU_CC
ifdef MOZ_GLUE_PROGRAM_LDFLAGS
DEFINES += -DMOZ_GLUE_IN_PROGRAM
else
ifndef MOZ_GLUE_PROGRAM_LDFLAGS
MOZ_GLUE_PROGRAM_LDFLAGS=$(MOZ_GLUE_LDFLAGS)
endif

View File

@ -9127,12 +9127,12 @@ ac_configure_args="$ac_configure_args --prefix=$dist"
ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
if test "$MOZ_MEMORY"; then
ac_configure_args="$ac_configure_args --enable-jemalloc"
fi
if test -n "$MOZ_GLUE_LDFLAGS"; then
export MOZ_GLUE_LDFLAGS
fi
if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
export MOZ_GLUE_PROGRAM_LDFLAGS
if test -n "$MOZ_GLUE_LDFLAGS"; then
export MOZ_GLUE_LDFLAGS
fi
if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
export MOZ_GLUE_PROGRAM_LDFLAGS
fi
fi
export MOZ_APP_NAME
AC_OUTPUT_SUBDIRS(js/src)

View File

@ -367,7 +367,8 @@ VPATH += $(srcdir)/assembler \
$(srcdir)/yarr \
$(NONE)
CPPSRCS += ExecutableAllocator.cpp \
CPPSRCS += Assertions.cpp \
ExecutableAllocator.cpp \
ARMAssembler.cpp \
MacroAssemblerARM.cpp \
MacroAssemblerX86Common.cpp \
@ -489,13 +490,6 @@ endif
include $(topsrcdir)/config/config.mk
ifeq (,$(MOZ_GLUE_PROGRAM_LDFLAGS))
# When building standalone, we need to include mfbt sources, and to declare
# "exported" mfbt symbols on its behalf when we use its headers.
include $(srcdir)/../../mfbt/sources.mk
DEFINES += -DIMPL_MFBT
endif
EXTRA_DSO_LDOPTS += $(NSPR_LIBS)
ifndef BUILD_OPT
@ -675,6 +669,11 @@ distclean::
DEFINES += -DEXPORT_JS_API
# mfbt is always packed with us, so if we're building a shared object,
# we need to declare "exported" mfbt symbols on its behalf when we use
# its headers.
DEFINES += -DIMPL_MFBT
INCLUDES += -I$(srcdir)
ifdef JS_THREADSAFE

View File

@ -91,11 +91,9 @@ public:
DoubleLessThanOrUnordered = X86Assembler::ConditionB,
DoubleLessThanOrEqualOrUnordered = X86Assembler::ConditionBE
};
static void staticAsserts() {
COMPILE_ASSERT(
!((X86Assembler::ConditionE | X86Assembler::ConditionNE | X86Assembler::ConditionA | X86Assembler::ConditionAE | X86Assembler::ConditionB | X86Assembler::ConditionBE) & DoubleConditionBits),
DoubleConditionBits_should_not_interfere_with_X86Assembler_Condition_codes);
}
COMPILE_ASSERT(
!((X86Assembler::ConditionE | X86Assembler::ConditionNE | X86Assembler::ConditionA | X86Assembler::ConditionAE | X86Assembler::ConditionB | X86Assembler::ConditionBE) & DoubleConditionBits),
DoubleConditionBits_should_not_interfere_with_X86Assembler_Condition_codes);
static const RegisterID stackPointerRegister = X86Registers::esp;

View File

@ -26,18 +26,6 @@
#ifndef WTF_Assertions_h
#define WTF_Assertions_h
#include "Platform.h"
#include "mozilla/Assertions.h"
#define ASSERT(assertion) MOZ_ASSERT(assertion)
#define ASSERT_UNUSED(variable, assertion) ASSERT(assertion)
#define ASSERT_NOT_REACHED() MOZ_NOT_REACHED("")
#define CRASH() MOZ_Crash()
#define COMPILE_ASSERT(exp, name) MOZ_STATIC_ASSERT(exp, #name)
#endif
#if 0
/*
no namespaces because this file has to be includable from C and Objective-C

View File

@ -256,9 +256,7 @@ endif
endif # WINNT && !GNU_CC
ifdef MOZ_GLUE_PROGRAM_LDFLAGS
DEFINES += -DMOZ_GLUE_IN_PROGRAM
else
ifndef MOZ_GLUE_PROGRAM_LDFLAGS
MOZ_GLUE_PROGRAM_LDFLAGS=$(MOZ_GLUE_LDFLAGS)
endif

View File

@ -105,9 +105,6 @@ CSRCS = \
# $(NULL)
DEFINES += -DEXPORT_JS_API
# Building against js_static requires that we declare mfbt sybols "exported"
# on its behalf.
DEFINES += -DIMPL_MFBT
LIBS = $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) $(NSPR_LIBS)

View File

@ -6601,7 +6601,7 @@ JS_AbortIfWrongThread(JSRuntime *rt)
{
#ifdef JS_THREADSAFE
if (!rt->onOwnerThread())
MOZ_Assert("rt->onOwnerThread()", __FILE__, __LINE__);
JS_Assert("rt->onOwnerThread()", __FILE__, __LINE__);
#endif
}

View File

@ -70,8 +70,6 @@
/************************************************************************/
#define JS_Assert MOZ_Assert
#ifdef __cplusplus
namespace JS {

View File

@ -349,7 +349,7 @@ types::TypeFailure(JSContext *cx, const char *fmt, ...)
cx->compartment->types.print(cx, true);
/* Always active, even in release builds */
MOZ_Assert(msgbuf, __FILE__, __LINE__);
JS_Assert(msgbuf, __FILE__, __LINE__);
*((volatile int *)NULL) = 0; /* Should never be reached */
}

View File

@ -69,6 +69,35 @@ JS_PUBLIC_DATA(uint32_t) OOM_counter = 0;
*/
JS_STATIC_ASSERT(sizeof(void *) == sizeof(void (*)()));
static JS_NEVER_INLINE void
CrashInJS()
{
/*
* We write 123 here so that the machine code for this function is
* unique. Otherwise the linker, trying to be smart, might use the
* same code for CrashInJS and for some other function. That
* messes up the signature in minidumps.
*/
#if defined(WIN32)
/*
* We used to call DebugBreak() on Windows, but amazingly, it causes
* the MSVS 2010 debugger not to be able to recover a call stack.
*/
*((volatile int *) NULL) = 123;
exit(3);
#elif defined(__APPLE__)
/*
* On Mac OS X, Breakpad ignores signals. Only real Mach exceptions are
* trapped.
*/
*((volatile int *) NULL) = 123; /* To continue from here in GDB: "return" then "continue". */
raise(SIGABRT); /* In case above statement gets nixed by the optimizer. */
#else
raise(SIGABRT); /* To continue from here in GDB: "signal 0". */
#endif
}
/*
* |JS_Assert| historically took |JSIntn ln| as its last argument. We've
* boiled |JSIntn ln| down to simply |int ln| so that mfbt may declare the
@ -77,6 +106,14 @@ JS_STATIC_ASSERT(sizeof(void *) == sizeof(void (*)()));
*/
JS_STATIC_ASSERT((tl::IsSameType<JSIntn, int>::result));
JS_PUBLIC_API(void)
JS_Assert(const char *s, const char *file, int ln)
{
fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
fflush(stderr);
CrashInJS();
}
#ifdef JS_BASIC_STATS
#include <math.h>

View File

@ -331,9 +331,9 @@ inline __attribute__ ((unused)) void MUST_FLOW_THROUGH(const char *label) {}
#ifdef JS_CRASH_DIAGNOSTICS
# define JS_POISON(p, val, size) memset((p), (val), (size))
# define JS_OPT_ASSERT(expr) \
((expr) ? (void)0 : MOZ_Assert(#expr, __FILE__, __LINE__))
((expr) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__))
# define JS_OPT_ASSERT_IF(cond, expr) \
((!(cond) || (expr)) ? (void)0 : MOZ_Assert(#expr, __FILE__, __LINE__))
((!(cond) || (expr)) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__))
#else
# define JS_POISON(p, val, size) ((void) 0)
# define JS_OPT_ASSERT(expr) ((void) 0)

View File

@ -53,9 +53,6 @@ CPPSRCS = \
$(NULL)
DEFINES += -DEXPORT_JS_API
# Building against js_static requires that we declare mfbt sybols "exported"
# on its behalf.
DEFINES += -DIMPL_MFBT
LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX)
ifdef MOZ_NATIVE_FFI

View File

@ -1008,7 +1008,7 @@ CrashIfInvalidSlot(StackFrame *fp, Value *vp)
if (vp < fp->slots() || vp >= fp->slots() + fp->script()->nslots) {
JS_ASSERT(false && "About to dereference invalid slot");
*(int *)0xbad = 0; // show up nicely in crash-stats
MOZ_Assert("About to dereference invalid slot", __FILE__, __LINE__);
JS_Assert("About to dereference invalid slot", __FILE__, __LINE__);
}
}

View File

@ -1,91 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sw=4 et tw=99 ft=cpp:
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2012
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mike Hommey <mh@glandium.org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Attributes.h"
#include "mozilla/Types.h"
#include <cstdio>
#include <cstdlib>
#ifndef WIN32
#include <signal.h>
#endif
/* Implementations of runtime and static assertion macros for C and C++. */
extern "C" {
MOZ_EXPORT_API(void)
MOZ_Crash()
{
/*
* We write 123 here so that the machine code for this function is
* unique. Otherwise the linker, trying to be smart, might use the
* same code for MOZ_Crash and for some other function. That
* messes up the signature in minidumps.
*/
#if defined(WIN32)
/*
* We used to call DebugBreak() on Windows, but amazingly, it causes
* the MSVS 2010 debugger not to be able to recover a call stack.
*/
*((volatile int *) NULL) = 123;
exit(3);
#elif defined(__APPLE__)
/*
* On Mac OS X, Breakpad ignores signals. Only real Mach exceptions are
* trapped.
*/
*((volatile int *) NULL) = 123; /* To continue from here in GDB: "return" then "continue". */
raise(SIGABRT); /* In case above statement gets nixed by the optimizer. */
#else
raise(SIGABRT); /* To continue from here in GDB: "signal 0". */
#endif
}
MOZ_EXPORT_API(void)
MOZ_Assert(const char* s, const char* file, int ln)
{
fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
fflush(stderr);
MOZ_Crash();
}
}

View File

@ -126,15 +126,26 @@
#define MOZ_STATIC_ASSERT_IF(cond, expr, reason) MOZ_STATIC_ASSERT(!(cond) || (expr), reason)
/*
* XXX: we're cheating here in order to avoid creating object files
* for mfbt /just/ to provide a function like FatalError() to be used
* by MOZ_ASSERT(). (It'll happen eventually, but for just ASSERT()
* it isn't worth the pain.) JS_Assert(), although unfortunately
* named, is part of SpiderMonkey's stable, external API, so this
* isn't quite as bad as it seems.
*
* Once mfbt needs object files, this unholy union with JS_Assert()
* will be broken.
*
* JS_Assert is present even in release builds, for the benefit of applications
* that build DEBUG and link against a non-DEBUG SpiderMonkey library.
*/
#ifdef __cplusplus
extern "C" {
#endif
extern MFBT_API(void)
MOZ_Crash(void);
extern MFBT_API(void)
MOZ_Assert(const char* s, const char* file, int ln);
JS_Assert(const char* s, const char* file, int ln);
#ifdef __cplusplus
} /* extern "C" */
@ -175,10 +186,10 @@ MOZ_Assert(const char* s, const char* file, int ln);
#ifdef DEBUG
/* First the single-argument form. */
# define MOZ_ASSERT_HELPER1(expr) \
((expr) ? ((void)0) : MOZ_Assert(#expr, __FILE__, __LINE__))
((expr) ? ((void)0) : JS_Assert(#expr, __FILE__, __LINE__))
/* Now the two-argument form. */
# define MOZ_ASSERT_HELPER2(expr, explain) \
((expr) ? ((void)0) : MOZ_Assert(#expr " (" explain ")", __FILE__, __LINE__))
((expr) ? ((void)0) : JS_Assert(#expr " (" explain ")", __FILE__, __LINE__))
/* And now, helper macrology up the wazoo. */
/* Count the number of arguments passed to MOZ_ASSERT. */
# define MOZ_COUNT_ASSERT_ARGS(...) \
@ -228,7 +239,7 @@ MOZ_Assert(const char* s, const char* file, int ln);
* }
*/
#ifdef DEBUG
# define MOZ_NOT_REACHED(reason) MOZ_Assert(reason, __FILE__, __LINE__)
# define MOZ_NOT_REACHED(reason) JS_Assert(reason, __FILE__, __LINE__)
#else
# define MOZ_NOT_REACHED(reason) ((void)0)
#endif

View File

@ -100,7 +100,7 @@ namespace detail {
* For more details, and examples of using these macros, see
* https://developer.mozilla.org/en/Using_RAII_classes_in_Mozilla
*/
class MOZ_EXPORT_API(GuardObjectNotifier)
class MFBT_API(GuardObjectNotifier)
{
private:
bool* statementDone;
@ -117,7 +117,7 @@ class MOZ_EXPORT_API(GuardObjectNotifier)
}
};
class MOZ_EXPORT_API(GuardObjectNotificationReceiver)
class MFBT_API(GuardObjectNotificationReceiver)
{
private:
bool statementDone;

View File

@ -42,11 +42,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = mozglue
LIBRARY_NAME = mfbt
FORCE_STATIC_LIB = 1
STL_FLAGS =
DIRS =
# exported_headers.mk defines the headers exported by mfbt. It is included by
@ -54,11 +49,4 @@ DIRS =
# work to install mfbt's exported headers itself.
include $(srcdir)/exported_headers.mk
# sources.mk defines the source files built for mfbt. It is included by mfbt
# itself and by the JS engine, which, when built standalone, must do the work
# to build mfbt sources itself.
include $(srcdir)/sources.mk
DEFINES += -DIMPL_MFBT
include $(topsrcdir)/config/rules.mk

View File

@ -129,17 +129,8 @@
# define MFBT_API(type) MOZ_EXPORT_API(type)
# define MFBT_DATA(type) MOZ_EXPORT_DATA(type)
#else
/*
* When mozglue is linked in the program, we need the MFBT API symbols
* to be weak.
*/
# if defined(MOZ_GLUE_IN_PROGRAM)
# define MFBT_API(type) __attribute__((weak)) MOZ_IMPORT_API(type)
# define MFBT_DATA(type) __attribute__((weak)) MOZ_IMPORT_DATA(type)
# else
# define MFBT_API(type) MOZ_IMPORT_API(type)
# define MFBT_DATA(type) MOZ_IMPORT_DATA(type)
# endif
# define MFBT_API(type) MOZ_IMPORT_API(type)
# define MFBT_DATA(type) MOZ_IMPORT_DATA(type)
#endif
/*

View File

@ -1,3 +0,0 @@
CPPSRCS += \
Assertions.cpp \
$(NULL)

View File

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

View File

@ -93,8 +93,6 @@ ifdef MOZ_LINKER
SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,linker,../linker)
endif
SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,mfbt,$(DEPTH)/mfbt)
ifeq (Android, $(OS_TARGET))
WRAP_LDFLAGS =
endif

View File

@ -318,6 +318,7 @@ 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,6 +7,8 @@
#include <vector>
#include <dlfcn.h>
/* Until RefPtr.h stops using JS_Assert */
#undef DEBUG
#include "mozilla/RefPtr.h"
#include "Zip.h"
@ -96,7 +98,7 @@ public:
{
bool ret = false;
if (directRefCnt) {
MOZ_ASSERT(directRefCnt <= mozilla::RefCounted<LibHandle>::refCount());
// 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)
{
MOZ_ASSERT(fd != -1);
MOZ_ASSERT(!(flags & MAP_SHARED));
// ASSERT(fd != -1)
// 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)
{
MOZ_ASSERT(fd != -1);
// 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)
{
MOZ_ASSERT(stream->GetType() == Zip::Stream::DEFLATE);
// 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)
{
MOZ_ASSERT(buffer);
MOZ_ASSERT(!(flags & MAP_SHARED));
// ASSERT(buffer)
// ASSERT(! flags & MAP_SHARED)
flags |= MAP_PRIVATE;
/* The deflate stream is uncompressed up to the required offset + length, if

View File

@ -9,7 +9,6 @@
#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,
@ -281,7 +280,7 @@ public:
void Init(const void *buf)
{
MOZ_ASSERT(contents == NULL);
// ASSERT(operator bool())
contents = reinterpret_cast<const T *>(buf);
}
@ -290,7 +289,7 @@ public:
*/
const T &operator[](const idx_t index) const
{
MOZ_ASSERT(contents);
// ASSERT(operator bool())
return contents[index];
}
@ -347,7 +346,7 @@ public:
void Init(const idx_t len)
{
MOZ_ASSERT(length == 0);
// ASSERT(length != 0)
length = len;
}
@ -373,8 +372,8 @@ public:
*/
const T &operator[](const idx_t index) const
{
MOZ_ASSERT(index < length);
MOZ_ASSERT(operator bool());
// ASSERT(index < length)
// ASSERT(operator bool())
return UnsizedArray<T>::operator[](index);
}

View File

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