Backed out 3 changesets (bug 896124, bug 784739, bug 894026) for Windows checktest orange on a CLOSED TREE.

Backed out changeset 631b3d5d54f4 (bug 896124)
Backed out changeset 5e1dd28ede5d (bug 894026)
Backed out changeset c10c0a6270ec (bug 784739)
This commit is contained in:
Ryan VanderMeulen 2013-07-26 00:08:51 -04:00
parent f3d03f59de
commit c5cf7535b6
23 changed files with 104 additions and 438 deletions

View File

@ -1003,7 +1003,7 @@ enum FirstCharKind {
Dec,
Colon,
Plus,
BasePrefix,
HexOct,
/* These two must be last, so that |c >= Space| matches both. */
Space,
@ -1022,7 +1022,7 @@ enum FirstCharKind {
* Dec: 49..57: '1'..'9'
* Colon: 58: ':'
* Plus: 43: '+'
* BasePrefix: 48: '0'
* HexOct: 48: '0'
* Space: 9, 11, 12: '\t', '\v', '\f'
* EOL: 10, 13: '\n', '\r'
*/
@ -1032,7 +1032,7 @@ static const uint8_t firstCharKinds[] = {
/* 10+ */ EOL, Space, Space, EOL, _______, _______, _______, _______, _______, _______,
/* 20+ */ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
/* 30+ */ _______, _______, Space, _______, String, _______, Ident, _______, _______, String,
/* 40+ */ OneChar, OneChar, _______, Plus, OneChar, _______, Dot, _______, BasePrefix, Dec,
/* 40+ */ OneChar, OneChar, _______, Plus, OneChar, _______, Dot, _______, HexOct, Dec,
/* 50+ */ Dec, Dec, Dec, Dec, Dec, Dec, Dec, Dec, Colon, OneChar,
/* 60+ */ _______, Equals, _______, OneChar, _______, Ident, Ident, Ident, Ident, Ident,
/* 70+ */ Ident, Ident, Ident, Ident, Ident, Ident, Ident, Ident, Ident, Ident,
@ -1397,8 +1397,10 @@ TokenStream::getTokenInternal()
goto out;
}
// Look for a hexadecimal, octal, or binary number.
if (c1kind == BasePrefix) {
/*
* Look for a hexadecimal or octal number.
*/
if (c1kind == HexOct) {
int radix;
c = getCharIgnoreEOL();
if (c == 'x' || c == 'X') {
@ -1412,28 +1414,6 @@ TokenStream::getTokenInternal()
numStart = userbuf.addressOfNextRawChar() - 1; /* one past the '0x' */
while (JS7_ISHEX(c))
c = getCharIgnoreEOL();
} else if (c == 'b' || c == 'B') {
radix = 2;
c = getCharIgnoreEOL();
if (c != '0' && c != '1') {
ungetCharIgnoreEOL(c);
reportError(JSMSG_MISSING_BINARY_DIGITS);
goto error;
}
numStart = userbuf.addressOfNextRawChar() - 1; /* one past the '0b' */
while (c == '0' || c == '1')
c = getCharIgnoreEOL();
} else if (c == 'o' || c == 'O') {
radix = 8;
c = getCharIgnoreEOL();
if (c < '0' || c > '7') {
ungetCharIgnoreEOL(c);
reportError(JSMSG_MISSING_OCTAL_DIGITS);
goto error;
}
numStart = userbuf.addressOfNextRawChar() - 1; /* one past the '0o' */
while ('0' <= c && c <= '7')
c = getCharIgnoreEOL();
} else if (JS7_ISDEC(c)) {
radix = 8;
numStart = userbuf.addressOfNextRawChar() - 1; /* one past the '0' */

View File

@ -184,7 +184,7 @@ MSG_DEF(JSMSG_BAD_OPERAND, 130, 1, JSEXN_SYNTAXERR, "invalid {0} oper
MSG_DEF(JSMSG_BAD_PROP_ID, 131, 0, JSEXN_SYNTAXERR, "invalid property id")
MSG_DEF(JSMSG_RESERVED_ID, 132, 1, JSEXN_SYNTAXERR, "{0} is a reserved identifier")
MSG_DEF(JSMSG_SYNTAX_ERROR, 133, 0, JSEXN_SYNTAXERR, "syntax error")
MSG_DEF(JSMSG_MISSING_BINARY_DIGITS, 134, 0, JSEXN_SYNTAXERR, "missing binary digits after '0b'")
MSG_DEF(JSMSG_UNUSED134, 134, 0, JSEXN_NONE, "")
MSG_DEF(JSMSG_BAD_PROTOTYPE, 135, 1, JSEXN_TYPEERR, "'prototype' property of {0} is not an object")
MSG_DEF(JSMSG_MISSING_EXPONENT, 136, 0, JSEXN_SYNTAXERR, "missing exponent")
MSG_DEF(JSMSG_OUT_OF_MEMORY, 137, 0, JSEXN_ERR, "out of memory")
@ -193,7 +193,7 @@ MSG_DEF(JSMSG_TOO_MANY_PARENS, 139, 0, JSEXN_INTERNALERR, "too many paren
MSG_DEF(JSMSG_UNTERMINATED_COMMENT, 140, 0, JSEXN_SYNTAXERR, "unterminated comment")
MSG_DEF(JSMSG_UNTERMINATED_REGEXP, 141, 0, JSEXN_SYNTAXERR, "unterminated regular expression literal")
MSG_DEF(JSMSG_BAD_CLONE_FUNOBJ_SCOPE, 142, 0, JSEXN_TYPEERR, "bad cloned function scope chain")
MSG_DEF(JSMSG_MISSING_OCTAL_DIGITS, 143, 0, JSEXN_SYNTAXERR, "missing octal digits after '0o'")
MSG_DEF(JSMSG_UNUSED143, 143, 0, JSEXN_NONE, "")
MSG_DEF(JSMSG_ILLEGAL_CHARACTER, 144, 0, JSEXN_SYNTAXERR, "illegal character")
MSG_DEF(JSMSG_BAD_OCTAL, 145, 1, JSEXN_SYNTAXERR, "{0} is not a legal ECMA-262 octal constant")
MSG_DEF(JSMSG_REPEAT_RANGE, 146, 0, JSEXN_RANGEERR, "repeat count must be positive and less than inifinity")

View File

@ -82,19 +82,12 @@ int main(int argc, char *argv[])
if (filter && strstr(name, filter) == NULL)
continue;
if (!JS_Init()) {
printf("TEST-UNEXPECTED-FAIL | %s | JS_Init() failed.\n", name);
failures++;
continue;
}
total += 1;
printf("%s\n", name);
if (!test->init()) {
printf("TEST-UNEXPECTED-FAIL | %s | Failed to initialize.\n", name);
failures++;
JS_ShutDown();
continue;
}
@ -110,7 +103,6 @@ int main(int argc, char *argv[])
failures++;
}
test->uninit();
JS_ShutDown();
}
if (failures) {

View File

@ -10,9 +10,9 @@
#include "jsapi.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/PodOperations.h"
#include "mozilla/ThreadLocal.h"
#include <ctype.h>
#include <stdarg.h>
@ -79,7 +79,6 @@
#include "vm/ErrorObject.h"
#include "vm/Interpreter.h"
#include "vm/NumericConversions.h"
#include "vm/Runtime.h"
#include "vm/Shape.h"
#include "vm/StopIterationObject.h"
#include "vm/StringBuffer.h"
@ -103,7 +102,6 @@ using namespace js;
using namespace js::gc;
using namespace js::types;
using mozilla::DebugOnly;
using mozilla::Maybe;
using mozilla::PodCopy;
using mozilla::PodZero;
@ -634,74 +632,15 @@ JS_IsBuiltinFunctionConstructor(JSFunction *fun)
/************************************************************************/
/*
* Has SpiderMonkey been initialized? This flag is used to control things that
* should happen only once across all runtimes. It's an API requirement that
* JS_Init (and JS_ShutDown, if called) be called in a thread-aware manner, so
* this variable doesn't need to be atomic.
* Has a new runtime ever been created? This flag is used to control things
* that should happen only once across all runtimes.
*/
static bool jsInitialized;
static JSBool js_NewRuntimeWasCalled = JS_FALSE;
JS_PUBLIC_API(JSBool)
JS_Init(void)
{
MOZ_ASSERT(!jsInitialized,
"must call JS_Init before any other JSAPI operation");
MOZ_ASSERT(!JSRuntime::hasLiveRuntimes(),
"how do we have live runtimes before JS_Init?");
#ifdef DEBUG
// Assert that the numbers associated with the error names in js.msg are
// monotonically increasing. It's not a compile-time check, but it's
// better than nothing.
int errorNumber = 0;
#define MSG_DEF(name, number, count, exception, format) \
JS_ASSERT(name == errorNumber++);
#include "js.msg"
#undef MSG_DEF
// Assert that each message format has the correct number of braced
// parameters.
#define MSG_DEF(name, number, count, exception, format) \
JS_BEGIN_MACRO \
unsigned numfmtspecs = 0; \
for (const char *fmt = format; *fmt != '\0'; fmt++) { \
if (*fmt == '{' && isdigit(fmt[1])) \
++numfmtspecs; \
} \
JS_ASSERT(count == numfmtspecs); \
JS_END_MACRO;
#include "js.msg"
#undef MSG_DEF
#endif /* DEBUG */
using js::TlsPerThreadData;
if (!TlsPerThreadData.initialized() && !TlsPerThreadData.init())
return false;
#if defined(JS_ION)
if (!ion::InitializeIon())
return false;
#endif
if (!ForkJoinSlice::InitializeTLS())
return false;
jsInitialized = true;
return true;
}
JS_PUBLIC_API(void)
JS_ShutDown(void)
{
MOZ_ASSERT(jsInitialized,
"JS_ShutDown must only be called after JS_Init and can't race with it");
MOZ_ASSERT(!JSRuntime::hasLiveRuntimes(),
"forgot to destroy a runtime before shutting down");
PRMJ_NowShutdown();
jsInitialized = false;
}
/*
* Thread Local Storage slot for storing the runtime for a thread.
*/
mozilla::ThreadLocal<PerThreadData *> js::TlsPerThreadData;
#ifdef DEBUG
JS_FRIEND_API(bool)
@ -959,9 +898,6 @@ JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
, enteredPolicy(NULL)
#endif
{
MOZ_ASSERT(jsInitialized, "must call JS_Init prior to creating any JSRuntimes");
liveRuntimesCount++;
/* Initialize infallibly first, so we can goto bad and JS_DestroyRuntime. */
JS_INIT_CLIST(&onNewGlobalObjectWatchers);
@ -1120,9 +1056,6 @@ JSRuntime::~JSRuntime()
gcStoreBuffer.disable();
gcNursery.disable();
#endif
DebugOnly<size_t> oldCount = liveRuntimesCount--;
JS_ASSERT(oldCount > 0);
}
#ifdef JS_THREADSAFE
@ -1131,7 +1064,7 @@ JSRuntime::setOwnerThread()
{
JS_ASSERT(ownerThread_ == (void *)0xc1ea12); /* "clear" */
JS_ASSERT(requestDepth == 0);
JS_ASSERT(jsInitialized);
JS_ASSERT(js_NewRuntimeWasCalled);
JS_ASSERT(js::TlsPerThreadData.get() == NULL);
ownerThread_ = PR_GetCurrentThread();
js::TlsPerThreadData.set(&mainThread);
@ -1148,7 +1081,7 @@ JSRuntime::clearOwnerThread()
{
assertValidThread();
JS_ASSERT(requestDepth == 0);
JS_ASSERT(jsInitialized);
JS_ASSERT(js_NewRuntimeWasCalled);
ownerThread_ = (void *)0xc1ea12; /* "clear" */
js::TlsPerThreadData.set(NULL);
nativeStackBase = 0;
@ -1184,10 +1117,52 @@ JSRuntime::assertValidThread() const
JS_PUBLIC_API(JSRuntime *)
JS_NewRuntime(uint32_t maxbytes, JSUseHelperThreads useHelperThreads)
{
if (!js_NewRuntimeWasCalled) {
#ifdef DEBUG
/*
* This code asserts that the numbers associated with the error names
* in jsmsg.def are monotonically increasing. It uses values for the
* error names enumerated in jscntxt.c. It's not a compile-time check
* but it's better than nothing.
*/
int errorNumber = 0;
#define MSG_DEF(name, number, count, exception, format) \
JS_ASSERT(name == errorNumber++);
#include "js.msg"
#undef MSG_DEF
#define MSG_DEF(name, number, count, exception, format) \
JS_BEGIN_MACRO \
unsigned numfmtspecs = 0; \
const char *fmt; \
for (fmt = format; *fmt != '\0'; fmt++) { \
if (*fmt == '{' && isdigit(fmt[1])) \
++numfmtspecs; \
} \
JS_ASSERT(count == numfmtspecs); \
JS_END_MACRO;
#include "js.msg"
#undef MSG_DEF
#endif /* DEBUG */
if (!js::TlsPerThreadData.init())
return NULL;
js_NewRuntimeWasCalled = JS_TRUE;
}
JSRuntime *rt = js_new<JSRuntime>(useHelperThreads);
if (!rt)
return NULL;
#if defined(JS_ION)
if (!ion::InitializeIon())
return NULL;
#endif
if (!ForkJoinSlice::InitializeTLS())
return NULL;
if (!rt->init(maxbytes)) {
JS_DestroyRuntime(rt);
return NULL;
@ -1215,6 +1190,12 @@ JS_SetICUMemoryFunctions(JS_ICUAllocFn allocFn, JS_ICUReallocFn reallocFn, JS_IC
#endif
}
JS_PUBLIC_API(void)
JS_ShutDown(void)
{
PRMJ_NowShutdown();
}
JS_PUBLIC_API(void *)
JS_GetRuntimePrivate(JSRuntime *rt)
{

View File

@ -1770,37 +1770,6 @@ typedef enum JSUseHelperThreads
JS_USE_HELPER_THREADS
} JSUseHelperThreads;
/**
* Initialize SpiderMonkey, returning true only if initialization succeeded.
* Once this method has succeeded, it is safe to call JS_NewRuntime and other
* JSAPI methods.
*
* This method must be called before any other JSAPI method is used on any
* thread. Once it has been used, it is safe to call any JSAPI method, and it
* remains safe to do so until JS_ShutDown is correctly called.
*/
extern JS_PUBLIC_API(JSBool)
JS_Init(void);
/**
* Destroy free-standing resources allocated by SpiderMonkey, not associated
* with any runtime, context, or other structure.
*
* This method should be called after all other JSAPI data has been properly
* cleaned up: every new runtime must have been destroyed, every new context
* must have been destroyed, and so on. Calling this method before all other
* resources have been destroyed has undefined behavior.
*
* Failure to call this method, at present, has no adverse effects other than
* leaking memory. This may not always be the case; it's recommended that all
* embedders call this method when all other JSAPI operations have completed.
*
* It is safe to call JS_Init again, and then to resume using SpiderMonkey as
* usual, once this method has returned.
*/
extern JS_PUBLIC_API(void)
JS_ShutDown(void);
extern JS_PUBLIC_API(JSRuntime *)
JS_NewRuntime(uint32_t maxbytes, JSUseHelperThreads useHelperThreads);
@ -1819,6 +1788,9 @@ typedef void (*JS_ICUFreeFn)(const void *, void *p);
extern JS_PUBLIC_API(bool)
JS_SetICUMemoryFunctions(JS_ICUAllocFn allocFn, JS_ICUReallocFn reallocFn, JS_ICUFreeFn freeFn);
extern JS_PUBLIC_API(void)
JS_ShutDown(void);
JS_PUBLIC_API(void *)
JS_GetRuntimePrivate(JSRuntime *rt);

View File

@ -204,6 +204,8 @@ JS_SetSourceHook(JSRuntime *rt, JS_SourceHook hook);
namespace js {
extern mozilla::ThreadLocal<PerThreadData *> TlsPerThreadData;
inline JSRuntime *
GetRuntime(const JSContext *cx)
{

View File

@ -5422,10 +5422,6 @@ main(int argc, char **argv, char **envp)
#endif
#endif
// Start the engine.
if (!JS_Init())
return 1;
/* Use the same parameters as the browser in xpcjsruntime.cpp. */
rt = JS_NewRuntime(32L * 1024L * 1024L, JS_USE_HELPER_THREADS);
if (!rt)

View File

@ -1,115 +0,0 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
//-----------------------------------------------------------------------------
var BUGNUMBER = 894026;
var summary = "Implement ES6 binary literals";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var chars = ['b', 'B'];
for (var i = 0; i < 2; i++)
{
if (i === 2)
{
chars.forEach(function(v)
{
try
{
eval('0' + v + i);
throw "didn't throw";
}
catch (e)
{
assertEq(e instanceof SyntaxError, true,
"no syntax error evaluating 0" + v + i + ", " +
"got " + e);
}
});
continue;
}
for (var j = 0; j < 2; j++)
{
if (j === 2)
{
chars.forEach(function(v)
{
try
{
eval('0' + v + i + j);
throw "didn't throw";
}
catch (e)
{
assertEq(e instanceof SyntaxError, true,
"no syntax error evaluating 0" + v + i + j + ", " +
"got " + e);
}
});
continue;
}
for (var k = 0; k < 2; k++)
{
if (k === 2)
{
chars.forEach(function(v)
{
try
{
eval('0' + v + i + j + k);
throw "didn't throw";
}
catch (e)
{
assertEq(e instanceof SyntaxError, true,
"no syntax error evaluating 0" + v + i + j + k + ", " +
"got " + e);
}
});
continue;
}
chars.forEach(function(v)
{
assertEq(eval('0' + v + i + j + k), i * 4 + j * 2 + k);
});
}
}
}
chars.forEach(function(v)
{
try
{
}
catch (e)
{
assertEq(e instanceof SyntaxError, true,
"no syntax error evaluating 0" + v + ", got " + e);
}
});
// Off-by-one check: '/' immediately precedes '0'.
assertEq(0b110/1, 6);
assertEq(0B10110/1, 22);
function strict()
{
"use strict";
return 0b11010101;
}
assertEq(strict(), 128 + 64 + 16 + 4 + 1);
/******************************************************************************/
if (typeof reportCompare === "function")
reportCompare(true, true);
print("Tests complete");

View File

@ -1,103 +0,0 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
//-----------------------------------------------------------------------------
var BUGNUMBER = 894026;
var summary = "Implement ES6 octal literals";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var chars = ['o', 'O'];
for (var i = 0; i < 8; i++)
{
if (i === 8)
{
chars.forEach(function(v)
{
try
{
eval('0' + v + i);
throw "didn't throw";
}
catch (e)
{
assertEq(e instanceof SyntaxError, true,
"no syntax error evaluating 0" + v + i + ", " +
"got " + e);
}
});
continue;
}
for (var j = 0; j < 8; j++)
{
if (j === 8)
{
chars.forEach(function(v)
{
try
{
eval('0' + v + i + j);
throw "didn't throw";
}
catch (e)
{
assertEq(e instanceof SyntaxError, true,
"no syntax error evaluating 0" + v + i + j + ", " +
"got " + e);
}
});
continue;
}
for (var k = 0; k < 8; k++)
{
if (k === 8)
{
chars.forEach(function(v)
{
try
{
eval('0' + v + i + j + k);
throw "didn't throw";
}
catch (e)
{
assertEq(e instanceof SyntaxError, true,
"no syntax error evaluating 0" + v + i + j + k + ", " +
"got " + e);
}
});
continue;
}
chars.forEach(function(v)
{
assertEq(eval('0' + v + i + j + k), i * 64 + j * 8 + k);
});
}
}
}
// Off-by-one check: '/' immediately precedes '0'.
assertEq(0o110/2, 36);
assertEq(0O644/2, 210);
function strict()
{
"use strict";
return 0o755;
}
assertEq(strict(), 7 * 64 + 5 * 8 + 5);
/******************************************************************************/
if (typeof reportCompare === "function")
reportCompare(true, true);
print("Tests complete");

View File

@ -1712,9 +1712,9 @@ bool
ForkJoinSlice::InitializeTLS()
{
if (!TLSInitialized) {
if (PR_NewThreadPrivateIndex(&ThreadPrivateIndex, NULL) != PR_SUCCESS)
return false;
TLSInitialized = true;
PRStatus status = PR_NewThreadPrivateIndex(&ThreadPrivateIndex, NULL);
return status == PR_SUCCESS;
}
return true;
}

View File

@ -7,7 +7,6 @@
#include "vm/Runtime-inl.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/ThreadLocal.h"
#include "mozilla/Util.h"
#include <locale.h>
@ -28,13 +27,7 @@
using namespace js;
using namespace js::gc;
using mozilla::Atomic;
using mozilla::PodZero;
using mozilla::ThreadLocal;
/* static */ ThreadLocal<PerThreadData*> js::TlsPerThreadData;
/* static */ Atomic<size_t> JSRuntime::liveRuntimesCount;
void
NewObjectCache::clearNurseryObjects(JSRuntime *rt)

View File

@ -7,12 +7,10 @@
#ifndef vm_Runtime_h
#define vm_Runtime_h
#include "mozilla/Atomics.h"
#include "mozilla/LinkedList.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/PodOperations.h"
#include "mozilla/TemplateLib.h"
#include "mozilla/ThreadLocal.h"
#include <setjmp.h>
#include <string.h>
@ -44,13 +42,6 @@
#pragma warning(disable:4355) /* Silence warning about "this" used in base member initializer list */
#endif
namespace js {
/* Thread Local Storage slot for storing the runtime for a thread. */
extern mozilla::ThreadLocal<PerThreadData*> TlsPerThreadData;
} // namespace js
struct DtoaState;
extern void
@ -1430,13 +1421,7 @@ struct JSRuntime : public JS::shadow::Runtime,
// their callee.
js::Value ionReturnOverride_;
static mozilla::Atomic<size_t> liveRuntimesCount;
public:
static bool hasLiveRuntimes() {
return liveRuntimesCount > 0;
}
bool hasIonReturnOverride() const {
return !ionReturnOverride_.isMagic();
}

View File

@ -1419,6 +1419,7 @@ XPCJSRuntime::~XPCJSRuntime()
delete mDetachedWrappedNativeProtoMap;
}
JS_ShutDown();
#ifdef MOZ_ENABLE_PROFILER_SPS
// Tell the profiler that the runtime is gone
if (PseudoStack *stack = mozilla_get_pseudo_stack())

View File

@ -10,7 +10,6 @@
#define mozilla_GuardObjects_h
#include "mozilla/Assertions.h"
#include "mozilla/NullPtr.h"
#include "mozilla/Types.h"
#ifdef __cplusplus
@ -74,7 +73,7 @@ class MOZ_EXPORT GuardObjectNotifier
bool* statementDone;
public:
GuardObjectNotifier() : statementDone(nullptr) { }
GuardObjectNotifier() : statementDone(NULL) { }
~GuardObjectNotifier() {
*statementDone = true;

View File

@ -46,8 +46,8 @@
* }
*
* void notifyObservers(char* topic) {
* for (Observer* o = list.getFirst(); o != nullptr; o = o->getNext())
* o->observe(topic);
* for (Observer* o = list.getFirst(); o != NULL; o = o->getNext())
* o->Observe(topic);
* }
* };
*
@ -58,7 +58,6 @@
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/NullPtr.h"
#ifdef __cplusplus
@ -71,10 +70,10 @@ template<typename T>
class LinkedListElement
{
/*
* It's convenient that we return nullptr when getNext() or getPrevious()
* hits the end of the list, but doing so costs an extra word of storage in
* each linked list node (to keep track of whether |this| is the sentinel
* node) and a branch on this value in getNext/getPrevious.
* It's convenient that we return NULL when getNext() or getPrevious() hits
* the end of the list, but doing so costs an extra word of storage in each
* linked list node (to keep track of whether |this| is the sentinel node)
* and a branch on this value in getNext/getPrevious.
*
* We could get rid of the extra word of storage by shoving the "is
* sentinel" bit into one of the pointers, although this would, of course,
@ -122,8 +121,8 @@ class LinkedListElement
}
/*
* Get the next element in the list, or nullptr if this is the last element
* in the list.
* Get the next element in the list, or NULL if this is the last element in
* the list.
*/
T* getNext() {
return next->asT();
@ -133,8 +132,8 @@ class LinkedListElement
}
/*
* Get the previous element in the list, or nullptr if this is the first
* element in the list.
* Get the previous element in the list, or NULL if this is the first element
* in the list.
*/
T* getPrevious() {
return prev->asT();
@ -207,18 +206,18 @@ class LinkedListElement
{ }
/*
* Return |this| cast to T* if we're a normal node, or return nullptr if
* we're a sentinel node.
* Return |this| cast to T* if we're a normal node, or return NULL if we're
* a sentinel node.
*/
T* asT() {
if (isSentinel)
return nullptr;
return NULL;
return static_cast<T*>(this);
}
const T* asT() const {
if (isSentinel)
return nullptr;
return NULL;
return static_cast<const T*>(this);
}
@ -285,7 +284,7 @@ class LinkedList
}
/*
* Get the first element of the list, or nullptr if the list is empty.
* Get the first element of the list, or NULL if the list is empty.
*/
T* getFirst() {
return sentinel.getNext();
@ -295,7 +294,7 @@ class LinkedList
}
/*
* Get the last element of the list, or nullptr if the list is empty.
* Get the last element of the list, or NULL if the list is empty.
*/
T* getLast() {
return sentinel.getPrevious();
@ -306,7 +305,7 @@ class LinkedList
/*
* Get and remove the first element of the list. If the list is empty,
* return nullptr.
* return NULL.
*/
T* popFirst() {
T* ret = sentinel.getNext();
@ -317,7 +316,7 @@ class LinkedList
/*
* Get and remove the last element of the list. If the list is empty,
* return nullptr.
* return NULL.
*/
T* popLast() {
T* ret = sentinel.getPrevious();

View File

@ -14,7 +14,6 @@
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/NullPtr.h"
#include "mozilla/Util.h"
namespace mozilla {
@ -61,7 +60,7 @@ class RangedPtr
#ifdef DEBUG
return RangedPtr<T>(p, rangeStart, rangeEnd);
#else
return RangedPtr<T>(p, nullptr, size_t(0));
return RangedPtr<T>(p, NULL, size_t(0));
#endif
}

View File

@ -54,7 +54,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/NullPtr.h"
namespace mozilla {
@ -196,7 +195,7 @@ template<typename T>
struct ScopedFreePtrTraits
{
typedef T* type;
static T* empty() { return nullptr; }
static T* empty() { return NULL; }
static void release(T* ptr) { free(ptr); }
};
SCOPED_TEMPLATE(ScopedFreePtr, ScopedFreePtrTraits)
@ -259,7 +258,7 @@ template <typename T>
struct TypeSpecificScopedPointerTraits
{
typedef T* type;
const static type empty() { return nullptr; }
const static type empty() { return NULL; }
const static void release(type value)
{
if (value)

View File

@ -29,7 +29,6 @@ __declspec(dllimport) unsigned long __stdcall TlsAlloc();
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/NullPtr.h"
namespace mozilla {
@ -108,7 +107,7 @@ ThreadLocal<T>::init()
key = TlsAlloc();
inited = key != 0xFFFFFFFFUL; // TLS_OUT_OF_INDEXES
#else
inited = !pthread_key_create(&key, nullptr);
inited = !pthread_key_create(&key, NULL);
#endif
return inited;
}

View File

@ -1050,7 +1050,7 @@ VectorBase<T, N, AP, TV>::extractRawBuffer()
if (usingInlineStorage()) {
ret = reinterpret_cast<T*>(this->malloc_(mLength * sizeof(T)));
if (!ret)
return nullptr;
return NULL;
Impl::copyConstruct(ret, beginNoCheck(), endNoCheck());
Impl::destroy(beginNoCheck(), endNoCheck());
/* mBegin, mCapacity are unchanged. */
@ -1105,14 +1105,14 @@ template<typename T, size_t N, class AP, class TV>
inline size_t
VectorBase<T, N, AP, TV>::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const
{
return usingInlineStorage() ? 0 : mallocSizeOf(beginNoCheck());
return usingInlineStorage() ? 0 : mallocSizeOf(beginNoCheck());
}
template<typename T, size_t N, class AP, class TV>
inline size_t
VectorBase<T, N, AP, TV>::sizeOfIncludingThis(MallocSizeOf mallocSizeOf) const
{
return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf);
return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf);
}
template<typename T, size_t N, class AP, class TV>

View File

@ -79,8 +79,6 @@
* at all. Thus, it is not used here.
*/
#include "mozilla/NullPtr.h"
// MAP_ANON(YMOUS) is not in any standard, and the C99 PRI* macros are
// not in C++98. Add defines as necessary.
#define __STDC_FORMAT_MACROS
@ -197,8 +195,8 @@ StrW32Error(DWORD errcode)
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, errcode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&errmsg, 0, nullptr);
NULL, errcode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR) &errmsg, 0, NULL);
// FormatMessage puts an unwanted newline at the end of the string
size_t n = strlen(errmsg)-1;

View File

@ -128,8 +128,6 @@ extern nsresult nsStringInputStreamConstructor(nsISupports *, REFNSIID, void **)
#include "GeckoProfiler.h"
#include "jsapi.h"
using namespace mozilla;
using base::AtExitManager;
using mozilla::ipc::BrowserProcessSubThread;
@ -466,11 +464,6 @@ NS_InitXPCOM2(nsIServiceManager* *result,
rv = nsCycleCollector_startup(CCSingleThread);
if (NS_FAILED(rv)) return rv;
// Initialize the JS engine.
if (!JS_Init()) {
NS_RUNTIMEABORT("JS_Init failed");
}
rv = nsComponentManagerImpl::gComponentManager->Init();
if (NS_FAILED(rv))
{
@ -700,12 +693,8 @@ ShutdownXPCOM(nsIServiceManager* servMgr)
if (nsComponentManagerImpl::gComponentManager) {
rv = (nsComponentManagerImpl::gComponentManager)->Shutdown();
NS_ASSERTION(NS_SUCCEEDED(rv), "Component Manager shutdown failed.");
} else {
} else
NS_WARNING("Component Manager was never created ...");
}
// Shut down the JS engine.
JS_ShutDown();
// Release our own singletons
// Do this _after_ shutting down the component manager, because the