Backed out changeset b6855b090307, possible memory leak. r=graphserver

--HG--
extra : rebase_source : f7e5b460f3c96ee74a0ba2abbd122c436e134063
This commit is contained in:
Jeff Walden 2012-09-17 15:11:24 -07:00
parent cc765a5e4f
commit a4b64b99e0
8 changed files with 32 additions and 105 deletions

View File

@ -165,7 +165,7 @@ INSTALLED_HEADERS = \
json.h \
jsproxy.h \
jsprf.h \
jsprototypes.h \
jsproto.tbl \
jsprvtd.h \
jspubtd.h \
jstypes.h \

View File

@ -48,9 +48,9 @@ js_AtomToPrintableString(JSContext *cx, JSAtom *atom, JSAutoByteString *bytes)
return js_ValueToPrintable(cx, StringValue(atom), bytes);
}
#define DEFINE_PROTO_STRING(name,code,init) const char js_##name##_str[] = #name;
JS_FOR_EACH_PROTOTYPE(DEFINE_PROTO_STRING)
#undef DEFINE_PROTO_STRING
#define JS_PROTO(name,code,init) const char js_##name##_str[] = #name;
#include "jsproto.tbl"
#undef JS_PROTO
/*
* String constants for common atoms defined in JSAtomState starting from
@ -79,9 +79,9 @@ const char *const js_common_atom_names[] = {
"xml", /* typeAtoms[JSTYPE_XML] */
js_null_str /* nullAtom */
#define PROTOTYPE_COMMON_ATOM(name,code,init) ,js_##name##_str
JS_FOR_EACH_PROTOTYPE(PROTOTYPE_COMMON_ATOM)
#undef PROTOTYPE_COMMON_ATOM
#define JS_PROTO(name,code,init) ,js_##name##_str
#include "jsproto.tbl"
#undef JS_PROTO
#define DEFINE_ATOM(id, text) ,js_##id##_str
#define DEFINE_PROTOTYPE_ATOM(id) ,js_##id##_str

View File

@ -11,7 +11,6 @@
#include "jsalloc.h"
#include "jsapi.h"
#include "jsfriendapi.h"
#include "jsprototypes.h"
#include "jsprvtd.h"
#include "jspubtd.h"
#include "jslock.h"
@ -227,9 +226,9 @@ extern const char js_object_str[];
extern const char js_undefined_str[];
/* Well-known predefined C strings. */
#define DECLARE_PROTO_STR(name,code,init) extern const char js_##name##_str[];
JS_FOR_EACH_PROTOTYPE(DECLARE_PROTO_STR)
#undef DECLARE_PROTO_STR
#define JS_PROTO(name,code,init) extern const char js_##name##_str[];
#include "jsproto.tbl"
#undef JS_PROTO
#define DEFINE_ATOM(id, text) extern const char js_##id##_str[];
#define DEFINE_PROTOTYPE_ATOM(id)

View File

@ -21,7 +21,7 @@
*
* DEFINE_PROTOTYPE_ATOM(id)
* Define an atom whose name is the same as one of those defined in
* jsprototypes.h. The code that processes that has already declared and
* jsproto.tbl. The code that processes that has already declared and
* defined the js_<id>_str global, so this defines only the JSAtomState
* member.
*

View File

@ -32,7 +32,6 @@
#include "jsonparser.h"
#include "jsopcode.h"
#include "jsprobes.h"
#include "jsprototypes.h"
#include "jsproxy.h"
#include "jsscope.h"
#include "jsscript.h"
@ -3472,15 +3471,14 @@ js_InitNullClass(JSContext *cx, JSObject *obj)
return NULL;
}
#define DECLARE_PROTOTYPE_CLASS_INIT(name,code,init) \
extern JSObject *init(JSContext *cx, JSObject *obj);
JS_FOR_EACH_PROTOTYPE(DECLARE_PROTOTYPE_CLASS_INIT)
#undef DECLARE_PROTOTYPE_CLASS_INIT
#define JS_PROTO(name,code,init) extern JSObject *init(JSContext *, JSObject *);
#include "jsproto.tbl"
#undef JS_PROTO
static JSClassInitializerOp lazy_prototype_init[JSProto_LIMIT] = {
#define LAZY_PROTOTYPE_INIT(name,code,init) init,
JS_FOR_EACH_PROTOTYPE(LAZY_PROTOTYPE_INIT)
#undef LAZY_PROTOTYPE_INIT
#define JS_PROTO(name,code,init) init,
#include "jsproto.tbl"
#undef JS_PROTO
};
namespace js {
@ -5171,10 +5169,10 @@ js_GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize)
if (!shape) {
const char *slotname = NULL;
if (obj->isGlobal()) {
#define TEST_SLOT_MATCHES_PROTOTYPE(name,code,init) \
if ((code) == slot) { slotname = js_##name##_str; goto found; }
JS_FOR_EACH_PROTOTYPE(TEST_SLOT_MATCHES_PROTOTYPE)
#undef TEST_SLOT_MATCHES_PROTOTYPE
#define JS_PROTO(name,code,init) \
if ((code) == slot) { slotname = js_##name##_str; goto found; }
#include "jsproto.tbl"
#undef JS_PROTO
}
found:
if (slotname)

View File

@ -1,64 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=4 sw=4 et tw=99 ft=cpp:
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* A higher-order macro for enumerating all JSProtoKey values. */
#ifndef jsprototypes_h___
#define jsprototypes_h___
#include "jsversion.h"
/*
* Enumerator codes in the second column must not change -- they are part of
* the JS XDR API. Also note the symbols in the third column are extern "C";
* clients should use extern "C" {} as appropriate when using this macro.
*/
#define JS_FOR_EACH_PROTOTYPE(macro) \
macro(Null, 0, js_InitNullClass) \
macro(Object, 1, js_InitObjectClass) \
macro(Function, 2, js_InitFunctionClass) \
macro(Array, 3, js_InitArrayClass) \
macro(Boolean, 4, js_InitBooleanClass) \
macro(JSON, 5, js_InitJSONClass) \
macro(Date, 6, js_InitDateClass) \
macro(Math, 7, js_InitMathClass) \
macro(Number, 8, js_InitNumberClass) \
macro(String, 9, js_InitStringClass) \
macro(RegExp, 10, js_InitRegExpClass) \
macro(XML, 11, js_InitXMLClass) \
macro(Namespace, 12, js_InitNamespaceClass) \
macro(QName, 13, js_InitQNameClass) \
macro(Error, 14, js_InitExceptionClasses) \
macro(InternalError, 15, js_InitExceptionClasses) \
macro(EvalError, 16, js_InitExceptionClasses) \
macro(RangeError, 17, js_InitExceptionClasses) \
macro(ReferenceError, 18, js_InitExceptionClasses) \
macro(SyntaxError, 19, js_InitExceptionClasses) \
macro(TypeError, 20, js_InitExceptionClasses) \
macro(URIError, 21, js_InitExceptionClasses) \
macro(Iterator, 22, js_InitIteratorClasses) \
macro(StopIteration, 23, js_InitIteratorClasses) \
macro(ArrayBuffer, 24, js_InitTypedArrayClasses) \
macro(Int8Array, 25, js_InitTypedArrayClasses) \
macro(Uint8Array, 26, js_InitTypedArrayClasses) \
macro(Int16Array, 27, js_InitTypedArrayClasses) \
macro(Uint16Array, 28, js_InitTypedArrayClasses) \
macro(Int32Array, 29, js_InitTypedArrayClasses) \
macro(Uint32Array, 30, js_InitTypedArrayClasses) \
macro(Float32Array, 31, js_InitTypedArrayClasses) \
macro(Float64Array, 32, js_InitTypedArrayClasses) \
macro(Uint8ClampedArray, 33, js_InitTypedArrayClasses) \
macro(Proxy, 34, js_InitProxyClass) \
macro(AnyName, 35, js_InitNullClass) \
macro(WeakMap, 36, js_InitWeakMapClass) \
macro(Map, 37, js_InitMapClass) \
macro(Set, 38, js_InitSetClass) \
macro(DataView, 39, js_InitTypedArrayClasses) \
macro(ParallelArray, 40, js_InitParallelArrayClass) \
#endif /* jsprototypes_h___ */

View File

@ -10,8 +10,6 @@
/*
* JS public API typedefs.
*/
#include "jsprototypes.h"
#include "jstypes.h"
/*
@ -108,8 +106,8 @@ typedef enum JSType {
/* Dense index into cached prototypes and class atoms for standard objects. */
typedef enum JSProtoKey {
#define PROTOKEY_AND_INITIALIZER(name,code,init) JSProto_##name = code,
JS_FOR_EACH_PROTOTYPE(PROTOKEY_AND_INITIALIZER)
#define JS_PROTO(name,code,init) JSProto_##name = code,
#include "jsproto.tbl"
#undef JS_PROTO
JSProto_LIMIT
} JSProtoKey;

View File

@ -13,19 +13,6 @@
#include "gc/Barrier.h"
#include "gc/Heap.h"
#if JS_HAS_XML_SUPPORT
extern JSObject *
js_InitXMLClass(JSContext *cx, JSObject *obj);
extern JSObject *
js_InitNamespaceClass(JSContext *cx, JSObject *obj);
extern JSObject *
js_InitQNameClass(JSContext *cx, JSObject *obj);
#else
#define js_InitXMLClass js_InitNullClass
#define js_InitNamespaceClass js_InitNullClass
#define js_InitQNameClass js_InitNullClass
#endif
#if JS_HAS_XML_SUPPORT
extern const char js_AnyName_str[];
@ -209,6 +196,15 @@ js_NewXMLObject(JSContext *cx, JSXMLClass xml_class);
extern JSObject *
js_GetXMLObject(JSContext *cx, JSXML *xml);
extern JSObject *
js_InitNamespaceClass(JSContext *cx, JSObject *obj);
extern JSObject *
js_InitQNameClass(JSContext *cx, JSObject *obj);
extern JSObject *
js_InitXMLClass(JSContext *cx, JSObject *obj);
extern JSObject *
js_InitXMLClasses(JSContext *cx, JSObject *obj);