From 4cb0c5c5efe330050f188ced70482698f5fdebf8 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Mon, 16 May 2011 22:59:40 -0700 Subject: [PATCH] [INFER] Cleanup for review, bug 657412. --- js/src/jsapi.cpp | 31 ++++++------------------------- js/src/jsapi.h | 5 ++--- js/src/jsarray.cpp | 7 ------- js/src/jscompartment.cpp | 30 ++++-------------------------- js/src/jsdate.cpp | 5 ++--- js/src/jsfun.cpp | 30 +++--------------------------- js/src/jsgc.cpp | 1 - js/src/jsgcinlines.h | 9 +++------ js/src/jshashtable.h | 10 ---------- js/src/jsinterp.cpp | 4 +--- js/src/jsiter.cpp | 1 - js/src/jsnum.cpp | 1 - js/src/jsobj.cpp | 9 ++------- js/src/json.cpp | 1 + js/src/jsprf.cpp | 1 - js/src/jsprobes.cpp | 1 - js/src/jsproxy.cpp | 5 +---- js/src/jsregexpinlines.h | 2 +- js/src/jsstr.cpp | 1 - js/src/jstypedarray.cpp | 2 -- js/src/jsvalue.h | 6 ------ js/src/jsxml.cpp | 5 ++--- 22 files changed, 28 insertions(+), 139 deletions(-) diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 778dd298616..e2d1cee6f8c 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -3465,10 +3465,8 @@ DefineUCProperty(JSContext *cx, JSObject *obj, const jschar *name, size_t namele uintN flags, intN tinyid) { JSAtom *atom = js_AtomizeChars(cx, name, AUTO_NAMELEN(name, namelen), 0); - if (!atom) - return false; - return DefinePropertyById(cx, obj, ATOM_TO_JSID(atom), value, getter, setter, attrs, - flags, tinyid); + return atom && DefinePropertyById(cx, obj, ATOM_TO_JSID(atom), value, getter, setter, attrs, + flags, tinyid); } JS_PUBLIC_API(JSBool) @@ -3857,7 +3855,6 @@ JS_SetPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp) CHECK_REQUEST(cx); assertSameCompartment(cx, obj, id); JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING); - return obj->setProperty(cx, id, Valueify(vp), false); } @@ -4128,14 +4125,6 @@ JS_NewArrayObject(JSContext *cx, jsint length, jsval *vector) CHECK_REQUEST(cx); /* NB: jsuint cast does ToUint32. */ assertSameCompartment(cx, JSValueArray(vector, vector ? (jsuint)length : 0)); - -#ifdef DEBUG - if (vector) { - for (int i = 0; i < length; i++) - JS_ASSERT(!Valueify(vector[i]).isMagic(JS_ARRAY_HOLE)); - } -#endif - return NewDenseCopiedArray(cx, (jsuint)length, Valueify(vector)); } @@ -4234,7 +4223,7 @@ JS_GetSecurityCallbacks(JSContext *cx) JS_PUBLIC_API(JSFunction *) JS_NewFunctionWithType(JSContext *cx, JSNative native, uintN nargs, uintN flags, JSObject *parent, const char *name, - JSTypeHandler handler, const char *fullName) + JSTypeHandler handler) { JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment); JSAtom *atom; @@ -4249,13 +4238,7 @@ JS_NewFunctionWithType(JSContext *cx, JSNative native, uintN nargs, uintN flags, if (!atom) return NULL; } - if (!handler) { - handler = JS_TypeHandlerDynamic; - if (!fullName) - fullName = "Unknown"; - } - return js_NewFunction(cx, NULL, Valueify(native), nargs, flags, parent, atom, - handler, fullName); + return js_NewFunction(cx, NULL, Valueify(native), nargs, flags, parent, atom, handler, name); } JS_PUBLIC_API(JSFunction *) @@ -4556,10 +4539,8 @@ JS_DefineFunctions(JSContext *cx, JSObject *obj, JSFunctionSpec *fs) if (!fun) return JS_FALSE; - if (cx->typeInferenceEnabled()) { - /* Mark the type handler for this function as generic. */ + if (cx->typeInferenceEnabled()) fun->getType()->asFunction()->isGeneric = true; - } /* * As jsapi.h notes, fs must point to storage that lives as long @@ -5151,9 +5132,9 @@ EvaluateUCScriptForPrincipalsCommon(JSContext *cx, JSObject *obj, JS_ASSERT(script->getVersion() == compileVersion); bool ok = Execute(cx, *obj, script, NULL, 0, Valueify(rval)); LAST_FRAME_CHECKS(cx, ok); - js_DestroyScript(cx, script); return ok; + } JS_PUBLIC_API(JSBool) diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 2476fdbe1d1..d35dfa93cae 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -2627,14 +2627,13 @@ JS_GetSecurityCallbacks(JSContext *cx); extern JS_PUBLIC_API(JSFunction *) JS_NewFunctionWithType(JSContext *cx, JSNative call, uintN nargs, uintN flags, JSObject *parent, const char *name, - JSTypeHandler handler, const char *fullName); + JSTypeHandler handler); static JS_ALWAYS_INLINE JSFunction* JS_NewFunction(JSContext *cx, JSNative call, uintN nargs, uintN flags, JSObject *parent, const char *name) { - return JS_NewFunctionWithType(cx, call, nargs, flags, parent, name, - NULL, NULL); + return JS_NewFunctionWithType(cx, call, nargs, flags, parent, name, NULL); } /* diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 0ac49cf95a3..e6fa5c0c581 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -605,7 +605,6 @@ js_SetLengthProperty(JSContext *cx, JSObject *obj, jsdouble length) v.setNumber(length); id = ATOM_TO_JSID(cx->runtime->atomState.lengthAtom); - /* We don't support read-only array length yet. */ return obj->setProperty(cx, id, &v, false); } @@ -2529,11 +2528,6 @@ array_splice(JSContext *cx, uintN argc, Value *vp) /* Get the type of the result object. */ TypeObject *type; if (obj->isArray()) { - /* - * :FIXME: This is getting a type whose prototype is that of the - * argument, even if it is the Array.prototype on a different - * global than the current frame. - */ type = obj->getType(); } else { /* @@ -2839,7 +2833,6 @@ array_slice(JSContext *cx, uintN argc, Value *vp) /* Get the type object for the returned array. */ TypeObject *type; if (obj->isArray()) { - /* :FIXME: Same issue as array_splice. */ type = obj->getType(); } else { /* diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp index 884a3dc379d..e018c527061 100644 --- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -333,6 +333,9 @@ JSCompartment::wrap(JSContext *cx, Value *vp) vp->setObject(*wrapper); + if (wrapper->getProto() != proto && !SetProto(cx, wrapper, proto, false)) + return false; + if (!crossCompartmentWrappers.put(wrapper->getProxyPrivate(), *vp)) return false; @@ -415,7 +418,6 @@ JSCompartment::wrap(JSContext *cx, AutoIdVector &props) } #if defined JS_METHODJIT && defined JS_MONOIC - /* * Check if the pool containing the code for jit should be destroyed, per the * heuristics in JSCompartment::sweep. @@ -445,33 +447,10 @@ static inline void ScriptTryDestroyCode(JSContext *cx, JSScript *script, bool normal, uint32 releaseInterval, uint32 &counter) { - /* - * Check if the JIT code for script should be destroyed. When JIT code has - * inlined frames, destroy the outer script if any of the inner scripts - * will need to be destroyed, preserving the invariant that we always have - * JIT code for any inlined frame which may need to be expanded. - */ - mjit::JITScript *jit = normal ? script->jitNormal : script->jitCtor; - - if (!jit) - return; - - if (ScriptPoolDestroyed(cx, jit, releaseInterval, counter)) { + if (jit && ScriptPoolDestroyed(cx, jit, releaseInterval, counter)) mjit::ReleaseScriptCode(cx, script, normal); - return; - } - - for (unsigned i = 0; i < jit->nInlineFrames; i++) { - JSScript *inner = jit->inlineFrames()[i].fun->script(); - if (!inner->jitNormal || /* Found inner first in the walk. */ - ScriptPoolDestroyed(cx, inner->jitNormal, releaseInterval, counter)) { - mjit::ReleaseScriptCode(cx, script, true); - return; - } - } } - #endif // JS_METHODJIT && JS_MONOIC /* @@ -570,7 +549,6 @@ JSCompartment::sweep(JSContext *cx, uint32 releaseInterval) for (JSCList *cursor = scripts.next; cursor != &scripts; cursor = cursor->next) { JSScript *script = reinterpret_cast(cursor); - if (script->hasJITCode()) { mjit::ic::SweepCallICs(cx, script, discardScripts); if (discardScripts) { diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index 92a1ebade58..612dd8e8d4b 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -2658,9 +2658,8 @@ js_InitDateClass(JSContext *cx, JSObject *obj) AutoValueRooter toUTCStringFun(cx); jsid toUTCStringId = ATOM_TO_JSID(cx->runtime->atomState.toUTCStringAtom); jsid toGMTStringId = ATOM_TO_JSID(cx->runtime->atomState.toGMTStringAtom); - if (!js_GetProperty(cx, proto, toUTCStringId, toUTCStringFun.addr())) - return NULL; - if (!js_DefineProperty(cx, proto, toGMTStringId, toUTCStringFun.addr(), + if (!js_GetProperty(cx, proto, toUTCStringId, toUTCStringFun.addr()) || + !js_DefineProperty(cx, proto, toGMTStringId, toUTCStringFun.addr(), PropertyStub, StrictPropertyStub, 0)) { return NULL; } diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index 6e0a5daa4ca..024a0b941bb 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -984,7 +984,7 @@ NewCallObject(JSContext *cx, JSScript *script, JSObject &scopeChain, JSObject *c Bindings &bindings = script->bindings; size_t argsVars = bindings.countArgsAndVars(); size_t slots = JSObject::CALL_RESERVED_SLOTS + argsVars; - gc::FinalizeKind kind = gc::GetGCObjectKind(slots, gc::FINALIZE_OBJECT2); + gc::FinalizeKind kind = gc::GetGCObjectKind(slots); JSObject *callobj = js_NewGCObject(cx, kind); if (!callobj) @@ -1634,8 +1634,6 @@ fun_getProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp) } #endif - JSAtom *atom = NULL; - switch (slot) { case FUN_ARGUMENTS: /* Warn if strict about f.arguments or equivalent unqualified uses. */ @@ -1652,23 +1650,16 @@ fun_getProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp) } else { vp->setNull(); } - atom = cx->runtime->atomState.argumentsAtom; break; case FUN_LENGTH: - vp->setInt32(fun->nargs); - atom = cx->runtime->atomState.lengthAtom; - break; - case FUN_ARITY: vp->setInt32(fun->nargs); - atom = cx->runtime->atomState.arityAtom; break; case FUN_NAME: vp->setString(fun->atom ? fun->atom : cx->runtime->emptyString); - atom = cx->runtime->atomState.nameAtom; break; case FUN_CALLER: @@ -1691,7 +1682,6 @@ fun_getProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp) } } } - atom = cx->runtime->atomState.callerAtom; break; default: @@ -1835,7 +1825,6 @@ fun_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags, if (!ResolveInterpretedFunctionPrototype(cx, obj)) return false; - *objp = obj; return true; } @@ -2467,26 +2456,13 @@ fun_bind(JSContext *cx, uintN argc, Value *vp) return true; } -static void -type_HandlerMonitored(JSContext *cx, JSTypeFunction *jsfun, JSTypeCallsite *jssite) -{ - /* - * Mark all calls to Function.prototype.call and Function.prototype.apply - * as monitored, so the compiler knows to keep track of all passed arguments. - */ - TypeCallsite *site = Valueify(jssite); - cx->compartment->types.monitorBytecode(cx, site->script, site->pc - site->script->code); - if (site->returnTypes) - site->returnTypes->addType(cx, TYPE_UNKNOWN); -} - static JSFunctionSpec function_methods[] = { #if JS_HAS_TOSOURCE JS_FN_TYPE(js_toSource_str, fun_toSource, 0,0, JS_TypeHandlerString), #endif JS_FN_TYPE(js_toString_str, fun_toString, 0,0, JS_TypeHandlerString), - JS_FN_TYPE(js_apply_str, js_fun_apply, 2,0, type_HandlerMonitored), - JS_FN_TYPE(js_call_str, js_fun_call, 1,0, type_HandlerMonitored), + JS_FN_TYPE(js_apply_str, js_fun_apply, 2,0, JS_TypeHandlerDynamic), + JS_FN_TYPE(js_call_str, js_fun_call, 1,0, JS_TypeHandlerDynamic), JS_FN_TYPE("bind", fun_bind, 1,0, JS_TypeHandlerDynamic), #if JS_HAS_GENERATORS JS_FN_TYPE("isGenerator", fun_isGenerator,0,0, JS_TypeHandlerBool), diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 8273a5c10f1..e21b2ba45da 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -1994,7 +1994,6 @@ js_DestroyScriptsToGC(JSContext *cx, JSCompartment *comp) while ((script = *listp) != NULL) { *listp = script->u.nextToGC; script->u.nextToGC = NULL; - js_DestroyCachedScript(cx, script); } } diff --git a/js/src/jsgcinlines.h b/js/src/jsgcinlines.h index 69c32c23c5e..eaa5277f1cb 100644 --- a/js/src/jsgcinlines.h +++ b/js/src/jsgcinlines.h @@ -120,13 +120,9 @@ GetGCThingTraceKind(const void *thing) /* Capacity for slotsToThingKind */ const size_t SLOTS_TO_THING_KIND_LIMIT = 17; -/* - * Get the best kind to use when making an object with the given slot count. - * fallback is the kind to use if the number of slots exceeds the maximum - * number of fixed slots for an object. - */ +/* Get the best kind to use when making an object with the given slot count. */ static inline FinalizeKind -GetGCObjectKind(size_t numSlots, FinalizeKind fallback = FINALIZE_OBJECT0) +GetGCObjectKind(size_t numSlots) { extern FinalizeKind slotsToThingKind[]; @@ -253,4 +249,5 @@ js_NewGCXML(JSContext *cx) } #endif + #endif /* jsgcinlines_h___ */ diff --git a/js/src/jshashtable.h b/js/src/jshashtable.h index 84d09b578d2..feb603bc716 100644 --- a/js/src/jshashtable.h +++ b/js/src/jshashtable.h @@ -46,12 +46,6 @@ #include "jsalloc.h" #include "jstl.h" -/* Gross special case for Gecko, which defines malloc/calloc/free. */ -#ifdef mozilla_mozalloc_macro_wrappers_h -# define JSHASHTABLE_UNDEFD_MOZALLOC_WRAPPERS -# include "mozilla/mozalloc_undef_macro_wrappers.h" -#endif - namespace js { /* Integral types for all hash functions. */ @@ -1223,8 +1217,4 @@ class HashSet } /* namespace js */ -#ifdef JSHASHTABLE_UNDEFD_MOZALLOC_WRAPPERS -# include "mozilla/mozalloc_macro_wrappers.h" -#endif - #endif diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index fe38f37a34b..6272c48dc52 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -1900,8 +1900,6 @@ namespace reprmeter { #define POP_COPY_TO(v) v = *--regs.sp #define POP_RETURN_VALUE() regs.fp()->setReturnValue(*--regs.sp) -/* Definitions for performing runtime checks required by type inference. */ - #define POP_BOOLEAN(cx, vp, b) \ JS_BEGIN_MACRO \ vp = ®s.sp[-1]; \ @@ -2630,6 +2628,7 @@ Interpret(JSContext *cx, StackFrame *entryFrame, uintN inlineCallCount, InterpMo advance_pc: regs.pc += len; op = (JSOp) *regs.pc; + do_op: CHECK_RECORDER(); LOG_OPCODE(op); @@ -3302,7 +3301,6 @@ BEGIN_CASE(JSOP_SETCONST) LOAD_ATOM(0, atom); JSObject &obj = cx->stack.currentVarObj(); const Value &ref = regs.sp[-1]; - if (!obj.defineProperty(cx, ATOM_TO_JSID(atom), ref, PropertyStub, StrictPropertyStub, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY)) { diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index d046465ef8e..c7ed8cac9a8 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -402,7 +402,6 @@ GetCustomIterator(JSContext *cx, JSObject *obj, uintN flags, Value *vp) -1, ObjectValue(*obj), NULL, bytes.ptr()); return false; } - return true; } diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index 182a76a0527..0f2cc0ae865 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -1129,7 +1129,6 @@ js_InitNumberClass(JSContext *cx, JSObject *obj) JSPROP_PERMANENT | JSPROP_READONLY)) { return NULL; } - return proto; } diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index a7e81bd5e8a..b5efe3dda3a 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -1649,7 +1649,6 @@ js_obj_defineGetter(JSContext *cx, uintN argc, Value *vp) uintN attrs; if (!CheckAccess(cx, obj, id, JSACC_WATCH, &junk, &attrs)) return JS_FALSE; - call.rval().setUndefined(); return obj->defineProperty(cx, id, UndefinedValue(), getter, StrictPropertyStub, JSPROP_ENUMERATE | JSPROP_GETTER | JSPROP_SHARED); @@ -1684,7 +1683,6 @@ js_obj_defineSetter(JSContext *cx, uintN argc, Value *vp) uintN attrs; if (!CheckAccess(cx, obj, id, JSACC_WATCH, &junk, &attrs)) return JS_FALSE; - call.rval().setUndefined(); return obj->defineProperty(cx, id, UndefinedValue(), PropertyStub, setter, JSPROP_ENUMERATE | JSPROP_SETTER | JSPROP_SHARED); @@ -2519,10 +2517,7 @@ obj_defineProperty(JSContext* cx, uintN argc, Value* vp) /* 15.2.3.6 step 4 */ JSBool junk; - if (!js_DefineOwnProperty(cx, obj, nameidr.id(), descval, &junk)) - return JS_FALSE; - - return JS_TRUE; + return js_DefineOwnProperty(cx, obj, nameidr.id(), descval, &junk); } static bool @@ -3373,7 +3368,7 @@ js_CloneBlockObject(JSContext *cx, JSObject *proto, StackFrame *fp) JS_ASSERT(proto->isStaticBlock()); size_t count = OBJ_BLOCK_COUNT(cx, proto); - gc::FinalizeKind kind = gc::GetGCObjectKind(count + 1, gc::FINALIZE_OBJECT2); + gc::FinalizeKind kind = gc::GetGCObjectKind(count + 1); js::types::TypeObject *type = proto->getNewType(cx); if (!type) diff --git a/js/src/json.cpp b/js/src/json.cpp index e019f9f83fc..5ee700e54f5 100644 --- a/js/src/json.cpp +++ b/js/src/json.cpp @@ -924,6 +924,7 @@ JSONParseError(JSONParser *jp, JSContext *cx) static bool Revive(JSContext *cx, const Value &reviver, Value *vp) { + JSObject *obj = NewBuiltinClassInstance(cx, &js_ObjectClass); if (!obj) return false; diff --git a/js/src/jsprf.cpp b/js/src/jsprf.cpp index 19b940adef1..d57ac57ce69 100644 --- a/js/src/jsprf.cpp +++ b/js/src/jsprf.cpp @@ -51,7 +51,6 @@ #include "jsutil.h" #include "jspubtd.h" #include "jsstr.h" -#include "jsobjinlines.h" using namespace js; diff --git a/js/src/jsprobes.cpp b/js/src/jsprobes.cpp index 69d22f82337..f6edb6f6405 100644 --- a/js/src/jsprobes.cpp +++ b/js/src/jsprobes.cpp @@ -43,7 +43,6 @@ #include "jsobj.h" #include "jsscript.h" #include "jsstr.h" -#include "jsobjinlines.h" #ifdef __APPLE__ #include "sharkctl.h" diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 770689c2c8a..08e37329fa2 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -56,7 +56,6 @@ using namespace js; using namespace js::gc; -using namespace js::types; namespace js { @@ -1098,8 +1097,6 @@ JS_FRIEND_API(Class) OuterWindowProxyClass = { } }; -static const char proxy_type_str[] = "Proxy:new"; - JSBool proxy_Call(JSContext *cx, uintN argc, Value *vp) { @@ -1463,7 +1460,7 @@ js_InitProxyClass(JSContext *cx, JSObject *obj) if (!module) return NULL; - TypeObject *type = cx->newTypeObject(js_ProxyClass.name, module->getProto()); + types::TypeObject *type = cx->newTypeObject(js_ProxyClass.name, module->getProto()); if (!type || !module->setTypeAndUniqueShape(cx, type)) return NULL; diff --git a/js/src/jsregexpinlines.h b/js/src/jsregexpinlines.h index 0fca5961364..70db45413e1 100644 --- a/js/src/jsregexpinlines.h +++ b/js/src/jsregexpinlines.h @@ -67,7 +67,7 @@ extern Class regexp_statics_class; static inline JSObject * regexp_statics_construct(JSContext *cx, GlobalObject *parent) { - JSObject *obj = NewObject(cx, ®exp_statics_class, parent, NULL); + JSObject *obj = NewObject(cx, ®exp_statics_class, NULL, parent); if (!obj) return NULL; RegExpStatics *res = cx->new_(); diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 6b892bd9213..6bb809c85fa 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -1864,7 +1864,6 @@ BuildFlatMatchArray(JSContext *cx, JSString *textstr, const FlatMatch &fm, Value JSObject *obj = NewSlowEmptyArray(cx); if (!obj) return false; - vp->setObject(*obj); return obj->defineProperty(cx, INT_TO_JSID(0), StringValue(fm.pattern())) && diff --git a/js/src/jstypedarray.cpp b/js/src/jstypedarray.cpp index d1db725e2b8..8741ee651dc 100644 --- a/js/src/jstypedarray.cpp +++ b/js/src/jstypedarray.cpp @@ -130,8 +130,6 @@ ArrayBuffer::class_finalize(JSContext *cx, JSObject *obj) } } -static const char arraybuffer_type_str[] = "ArrayBuffer:new"; - /* * new ArrayBuffer(byteLength) */ diff --git a/js/src/jsvalue.h b/js/src/jsvalue.h index 072f7f5ea90..3b1969628f2 100644 --- a/js/src/jsvalue.h +++ b/js/src/jsvalue.h @@ -197,14 +197,11 @@ BOX_NON_DOUBLE_JSVAL(JSValueType type, uint64 *slot) { jsval_layout l; JS_ASSERT(type > JSVAL_TYPE_DOUBLE && type <= JSVAL_UPPER_INCL_TYPE_OF_BOXABLE_SET); - /* - // FIXME overasserting JS_ASSERT_IF(type == JSVAL_TYPE_STRING || type == JSVAL_TYPE_OBJECT || type == JSVAL_TYPE_NONFUNOBJ || type == JSVAL_TYPE_FUNOBJ, *(uint32 *)slot != 0); - */ l.s.tag = JSVAL_TYPE_TO_TAG(type & 0xF); /* A 32-bit value in a 64-bit slot always occupies the low-addressed end. */ l.s.payload.u32 = *(uint32 *)slot; @@ -304,14 +301,11 @@ BOX_NON_DOUBLE_JSVAL(JSValueType type, uint64 *slot) uint32 shift = isI32 * 32; uint64 mask = ((uint64)-1) >> shift; uint64 payload = *slot & mask; - /* - // FIXME overasserting JS_ASSERT_IF(type == JSVAL_TYPE_STRING || type == JSVAL_TYPE_OBJECT || type == JSVAL_TYPE_NONFUNOBJ || type == JSVAL_TYPE_FUNOBJ, payload != 0); - */ l.asBits = payload | JSVAL_TYPE_TO_SHIFTED_TAG(type & 0xF); return l; } diff --git a/js/src/jsxml.cpp b/js/src/jsxml.cpp index a7a2ae62186..26513ec002a 100644 --- a/js/src/jsxml.cpp +++ b/js/src/jsxml.cpp @@ -223,7 +223,7 @@ namespace_equality(JSContext *cx, JSObject *obj, const Value *v, JSBool *bp) } JS_FRIEND_DATA(Class) js_NamespaceClass = { - js_Namespace_str, + "Namespace", JSCLASS_CONSTRUCT_PROTOTYPE | JSCLASS_HAS_RESERVED_SLOTS(JSObject::NAMESPACE_CLASS_RESERVED_SLOTS) | JSCLASS_HAS_CACHED_PROTO(JSProto_Namespace), @@ -336,7 +336,7 @@ qname_equality(JSContext *cx, JSObject *qn, const Value *v, JSBool *bp) } JS_FRIEND_DATA(Class) js_QNameClass = { - js_QName_str, + "QName", JSCLASS_CONSTRUCT_PROTOTYPE | JSCLASS_HAS_RESERVED_SLOTS(JSObject::QNAME_CLASS_RESERVED_SLOTS) | JSCLASS_HAS_CACHED_PROTO(JSProto_QName), @@ -7318,7 +7318,6 @@ js_SetDefaultXMLNamespace(JSContext *cx, const Value &v) return JS_FALSE; JSObject &varobj = cx->stack.currentVarObj(); - if (!varobj.defineProperty(cx, JS_DEFAULT_XML_NAMESPACE_ID, ObjectValue(*ns), PropertyStub, StrictPropertyStub, JSPROP_PERMANENT)) { return JS_FALSE;