Bug 825714 followup: Silence various warnings and make various style corrections. r=billm

This commit is contained in:
Nicholas D. Matsakis 2013-01-25 14:09:25 -08:00
parent d35081c114
commit aa174a5dd7
5 changed files with 64 additions and 59 deletions

View File

@ -14,8 +14,6 @@
#include "ion/Bailouts.h"
#include "ion/VMFunctions.h"
#include "jscntxtinlines.h"
using namespace js;
using namespace js::ion;

View File

@ -467,13 +467,17 @@ class PerThreadData : public js::PerThreadDataFriendFields
int gcAssertNoGCDepth;
#endif
// If Ion code is on the stack, and has called into C++, this will be
// aligned to an Ion exit frame.
/*
* If Ion code is on the stack, and has called into C++, this will be
* aligned to an Ion exit frame.
*/
uint8_t *ionTop;
JSContext *ionJSContext;
uintptr_t ionStackLimit;
// This points to the most recent Ion activation running on the thread.
/*
* This points to the most recent Ion activation running on the thread.
*/
js::ion::IonActivation *ionActivation;
/*
@ -1360,7 +1364,8 @@ VersionIsKnown(JSVersion version)
}
inline void
FreeOp::free_(void* p) {
FreeOp::free_(void *p)
{
if (shouldFreeLater()) {
runtime()->gcHelperThread.freeLater(p);
return;
@ -2300,4 +2305,46 @@ class ContextAllocPolicy
#pragma warning(pop)
#endif
void *
JSRuntime::malloc_(size_t bytes, JSCompartment *comp, JSContext *cx)
{
JS_ASSERT_IF(cx != NULL, cx->compartment == comp);
updateMallocCounter(comp, bytes);
void *p = js_malloc(bytes);
return JS_LIKELY(!!p) ? p : onOutOfMemory(NULL, bytes, cx);
}
void *
JSRuntime::calloc_(size_t bytes, JSCompartment *comp, JSContext *cx)
{
JS_ASSERT_IF(cx != NULL, cx->compartment == comp);
updateMallocCounter(comp, bytes);
void *p = js_calloc(bytes);
return JS_LIKELY(!!p) ? p : onOutOfMemory(reinterpret_cast<void *>(1), bytes, cx);
}
void *
JSRuntime::realloc_(void *p, size_t oldBytes, size_t newBytes, JSCompartment *comp, JSContext *cx)
{
JS_ASSERT_IF(cx != NULL, cx->compartment == comp);
JS_ASSERT(oldBytes < newBytes);
updateMallocCounter(comp, newBytes - oldBytes);
void *p2 = js_realloc(p, newBytes);
return JS_LIKELY(!!p2) ? p2 : onOutOfMemory(p, newBytes, cx);
}
void *
JSRuntime::realloc_(void *p, size_t bytes, JSCompartment *comp, JSContext *cx)
{
JS_ASSERT_IF(cx != NULL, cx->compartment == comp);
/*
* For compatibility we do not account for realloc that increases
* previously allocated memory.
*/
if (!p)
updateMallocCounter(comp, bytes);
void *p2 = js_realloc(p, bytes);
return JS_LIKELY(!!p2) ? p2 : onOutOfMemory(p, bytes, cx);
}
#endif /* jscntxt_h___ */

View File

@ -22,44 +22,6 @@
#include "jsgcinlines.h"
void*
JSRuntime::malloc_(size_t bytes, JSCompartment *comp, JSContext *cx) {
JS_ASSERT_IF(cx != NULL, cx->compartment == comp);
updateMallocCounter(comp, bytes);
void *p = js_malloc(bytes);
return JS_LIKELY(!!p) ? p : onOutOfMemory(NULL, bytes, cx);
}
void*
JSRuntime::calloc_(size_t bytes, JSCompartment *comp, JSContext *cx) {
JS_ASSERT_IF(cx != NULL, cx->compartment == comp);
updateMallocCounter(comp, bytes);
void *p = js_calloc(bytes);
return JS_LIKELY(!!p) ? p : onOutOfMemory(reinterpret_cast<void *>(1), bytes, cx);
}
void*
JSRuntime::realloc_(void* p, size_t oldBytes, size_t newBytes, JSCompartment *comp, JSContext *cx) {
JS_ASSERT_IF(cx != NULL, cx->compartment == comp);
JS_ASSERT(oldBytes < newBytes);
updateMallocCounter(comp, newBytes - oldBytes);
void *p2 = js_realloc(p, newBytes);
return JS_LIKELY(!!p2) ? p2 : onOutOfMemory(p, newBytes, cx);
}
void*
JSRuntime::realloc_(void* p, size_t bytes, JSCompartment *comp, JSContext *cx) {
JS_ASSERT_IF(cx != NULL, cx->compartment == comp);
/*
* For compatibility we do not account for realloc that increases
* previously allocated memory.
*/
if (!p)
updateMallocCounter(comp, bytes);
void *p2 = js_realloc(p, bytes);
return JS_LIKELY(!!p2) ? p2 : onOutOfMemory(p, bytes, cx);
}
namespace js {
inline void

View File

@ -9,8 +9,6 @@
#include "js/CharacterEncoding.h"
#include "jscntxtinlines.h"
using namespace JS;
Latin1CharsZ