[INFER] Cleanup for review, bug 657412.

This commit is contained in:
Brian Hackett 2011-05-16 22:59:40 -07:00
parent 98763bc2cb
commit 4cb0c5c5ef
22 changed files with 28 additions and 139 deletions

View File

@ -3465,10 +3465,8 @@ DefineUCProperty(JSContext *cx, JSObject *obj, const jschar *name, size_t namele
uintN flags, intN tinyid) uintN flags, intN tinyid)
{ {
JSAtom *atom = js_AtomizeChars(cx, name, AUTO_NAMELEN(name, namelen), 0); JSAtom *atom = js_AtomizeChars(cx, name, AUTO_NAMELEN(name, namelen), 0);
if (!atom) return atom && DefinePropertyById(cx, obj, ATOM_TO_JSID(atom), value, getter, setter, attrs,
return false; flags, tinyid);
return DefinePropertyById(cx, obj, ATOM_TO_JSID(atom), value, getter, setter, attrs,
flags, tinyid);
} }
JS_PUBLIC_API(JSBool) JS_PUBLIC_API(JSBool)
@ -3857,7 +3855,6 @@ JS_SetPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
assertSameCompartment(cx, obj, id); assertSameCompartment(cx, obj, id);
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING); JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING);
return obj->setProperty(cx, id, Valueify(vp), false); return obj->setProperty(cx, id, Valueify(vp), false);
} }
@ -4128,14 +4125,6 @@ JS_NewArrayObject(JSContext *cx, jsint length, jsval *vector)
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
/* NB: jsuint cast does ToUint32. */ /* NB: jsuint cast does ToUint32. */
assertSameCompartment(cx, JSValueArray(vector, vector ? (jsuint)length : 0)); 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)); return NewDenseCopiedArray(cx, (jsuint)length, Valueify(vector));
} }
@ -4234,7 +4223,7 @@ JS_GetSecurityCallbacks(JSContext *cx)
JS_PUBLIC_API(JSFunction *) JS_PUBLIC_API(JSFunction *)
JS_NewFunctionWithType(JSContext *cx, JSNative native, uintN nargs, uintN flags, JS_NewFunctionWithType(JSContext *cx, JSNative native, uintN nargs, uintN flags,
JSObject *parent, const char *name, JSObject *parent, const char *name,
JSTypeHandler handler, const char *fullName) JSTypeHandler handler)
{ {
JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment); JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment);
JSAtom *atom; JSAtom *atom;
@ -4249,13 +4238,7 @@ JS_NewFunctionWithType(JSContext *cx, JSNative native, uintN nargs, uintN flags,
if (!atom) if (!atom)
return NULL; return NULL;
} }
if (!handler) { return js_NewFunction(cx, NULL, Valueify(native), nargs, flags, parent, atom, handler, name);
handler = JS_TypeHandlerDynamic;
if (!fullName)
fullName = "Unknown";
}
return js_NewFunction(cx, NULL, Valueify(native), nargs, flags, parent, atom,
handler, fullName);
} }
JS_PUBLIC_API(JSFunction *) JS_PUBLIC_API(JSFunction *)
@ -4556,10 +4539,8 @@ JS_DefineFunctions(JSContext *cx, JSObject *obj, JSFunctionSpec *fs)
if (!fun) if (!fun)
return JS_FALSE; return JS_FALSE;
if (cx->typeInferenceEnabled()) { if (cx->typeInferenceEnabled())
/* Mark the type handler for this function as generic. */
fun->getType()->asFunction()->isGeneric = true; fun->getType()->asFunction()->isGeneric = true;
}
/* /*
* As jsapi.h notes, fs must point to storage that lives as long * 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); JS_ASSERT(script->getVersion() == compileVersion);
bool ok = Execute(cx, *obj, script, NULL, 0, Valueify(rval)); bool ok = Execute(cx, *obj, script, NULL, 0, Valueify(rval));
LAST_FRAME_CHECKS(cx, ok); LAST_FRAME_CHECKS(cx, ok);
js_DestroyScript(cx, script); js_DestroyScript(cx, script);
return ok; return ok;
} }
JS_PUBLIC_API(JSBool) JS_PUBLIC_API(JSBool)

View File

@ -2627,14 +2627,13 @@ JS_GetSecurityCallbacks(JSContext *cx);
extern JS_PUBLIC_API(JSFunction *) extern JS_PUBLIC_API(JSFunction *)
JS_NewFunctionWithType(JSContext *cx, JSNative call, uintN nargs, uintN flags, JS_NewFunctionWithType(JSContext *cx, JSNative call, uintN nargs, uintN flags,
JSObject *parent, const char *name, JSObject *parent, const char *name,
JSTypeHandler handler, const char *fullName); JSTypeHandler handler);
static JS_ALWAYS_INLINE JSFunction* static JS_ALWAYS_INLINE JSFunction*
JS_NewFunction(JSContext *cx, JSNative call, uintN nargs, uintN flags, JS_NewFunction(JSContext *cx, JSNative call, uintN nargs, uintN flags,
JSObject *parent, const char *name) JSObject *parent, const char *name)
{ {
return JS_NewFunctionWithType(cx, call, nargs, flags, parent, name, return JS_NewFunctionWithType(cx, call, nargs, flags, parent, name, NULL);
NULL, NULL);
} }
/* /*

View File

@ -605,7 +605,6 @@ js_SetLengthProperty(JSContext *cx, JSObject *obj, jsdouble length)
v.setNumber(length); v.setNumber(length);
id = ATOM_TO_JSID(cx->runtime->atomState.lengthAtom); id = ATOM_TO_JSID(cx->runtime->atomState.lengthAtom);
/* We don't support read-only array length yet. */ /* We don't support read-only array length yet. */
return obj->setProperty(cx, id, &v, false); 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. */ /* Get the type of the result object. */
TypeObject *type; TypeObject *type;
if (obj->isArray()) { 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(); type = obj->getType();
} else { } else {
/* /*
@ -2839,7 +2833,6 @@ array_slice(JSContext *cx, uintN argc, Value *vp)
/* Get the type object for the returned array. */ /* Get the type object for the returned array. */
TypeObject *type; TypeObject *type;
if (obj->isArray()) { if (obj->isArray()) {
/* :FIXME: Same issue as array_splice. */
type = obj->getType(); type = obj->getType();
} else { } else {
/* /*

View File

@ -333,6 +333,9 @@ JSCompartment::wrap(JSContext *cx, Value *vp)
vp->setObject(*wrapper); vp->setObject(*wrapper);
if (wrapper->getProto() != proto && !SetProto(cx, wrapper, proto, false))
return false;
if (!crossCompartmentWrappers.put(wrapper->getProxyPrivate(), *vp)) if (!crossCompartmentWrappers.put(wrapper->getProxyPrivate(), *vp))
return false; return false;
@ -415,7 +418,6 @@ JSCompartment::wrap(JSContext *cx, AutoIdVector &props)
} }
#if defined JS_METHODJIT && defined JS_MONOIC #if defined JS_METHODJIT && defined JS_MONOIC
/* /*
* Check if the pool containing the code for jit should be destroyed, per the * Check if the pool containing the code for jit should be destroyed, per the
* heuristics in JSCompartment::sweep. * heuristics in JSCompartment::sweep.
@ -445,33 +447,10 @@ static inline void
ScriptTryDestroyCode(JSContext *cx, JSScript *script, bool normal, ScriptTryDestroyCode(JSContext *cx, JSScript *script, bool normal,
uint32 releaseInterval, uint32 &counter) 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; mjit::JITScript *jit = normal ? script->jitNormal : script->jitCtor;
if (jit && ScriptPoolDestroyed(cx, jit, releaseInterval, counter))
if (!jit)
return;
if (ScriptPoolDestroyed(cx, jit, releaseInterval, counter)) {
mjit::ReleaseScriptCode(cx, script, normal); 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 #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) { for (JSCList *cursor = scripts.next; cursor != &scripts; cursor = cursor->next) {
JSScript *script = reinterpret_cast<JSScript *>(cursor); JSScript *script = reinterpret_cast<JSScript *>(cursor);
if (script->hasJITCode()) { if (script->hasJITCode()) {
mjit::ic::SweepCallICs(cx, script, discardScripts); mjit::ic::SweepCallICs(cx, script, discardScripts);
if (discardScripts) { if (discardScripts) {

View File

@ -2658,9 +2658,8 @@ js_InitDateClass(JSContext *cx, JSObject *obj)
AutoValueRooter toUTCStringFun(cx); AutoValueRooter toUTCStringFun(cx);
jsid toUTCStringId = ATOM_TO_JSID(cx->runtime->atomState.toUTCStringAtom); jsid toUTCStringId = ATOM_TO_JSID(cx->runtime->atomState.toUTCStringAtom);
jsid toGMTStringId = ATOM_TO_JSID(cx->runtime->atomState.toGMTStringAtom); jsid toGMTStringId = ATOM_TO_JSID(cx->runtime->atomState.toGMTStringAtom);
if (!js_GetProperty(cx, proto, toUTCStringId, toUTCStringFun.addr())) if (!js_GetProperty(cx, proto, toUTCStringId, toUTCStringFun.addr()) ||
return NULL; !js_DefineProperty(cx, proto, toGMTStringId, toUTCStringFun.addr(),
if (!js_DefineProperty(cx, proto, toGMTStringId, toUTCStringFun.addr(),
PropertyStub, StrictPropertyStub, 0)) { PropertyStub, StrictPropertyStub, 0)) {
return NULL; return NULL;
} }

View File

@ -984,7 +984,7 @@ NewCallObject(JSContext *cx, JSScript *script, JSObject &scopeChain, JSObject *c
Bindings &bindings = script->bindings; Bindings &bindings = script->bindings;
size_t argsVars = bindings.countArgsAndVars(); size_t argsVars = bindings.countArgsAndVars();
size_t slots = JSObject::CALL_RESERVED_SLOTS + argsVars; 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); JSObject *callobj = js_NewGCObject(cx, kind);
if (!callobj) if (!callobj)
@ -1634,8 +1634,6 @@ fun_getProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
} }
#endif #endif
JSAtom *atom = NULL;
switch (slot) { switch (slot) {
case FUN_ARGUMENTS: case FUN_ARGUMENTS:
/* Warn if strict about f.arguments or equivalent unqualified uses. */ /* 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 { } else {
vp->setNull(); vp->setNull();
} }
atom = cx->runtime->atomState.argumentsAtom;
break; break;
case FUN_LENGTH: case FUN_LENGTH:
vp->setInt32(fun->nargs);
atom = cx->runtime->atomState.lengthAtom;
break;
case FUN_ARITY: case FUN_ARITY:
vp->setInt32(fun->nargs); vp->setInt32(fun->nargs);
atom = cx->runtime->atomState.arityAtom;
break; break;
case FUN_NAME: case FUN_NAME:
vp->setString(fun->atom ? fun->atom vp->setString(fun->atom ? fun->atom
: cx->runtime->emptyString); : cx->runtime->emptyString);
atom = cx->runtime->atomState.nameAtom;
break; break;
case FUN_CALLER: case FUN_CALLER:
@ -1691,7 +1682,6 @@ fun_getProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
} }
} }
} }
atom = cx->runtime->atomState.callerAtom;
break; break;
default: default:
@ -1835,7 +1825,6 @@ fun_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
if (!ResolveInterpretedFunctionPrototype(cx, obj)) if (!ResolveInterpretedFunctionPrototype(cx, obj))
return false; return false;
*objp = obj; *objp = obj;
return true; return true;
} }
@ -2467,26 +2456,13 @@ fun_bind(JSContext *cx, uintN argc, Value *vp)
return true; 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[] = { static JSFunctionSpec function_methods[] = {
#if JS_HAS_TOSOURCE #if JS_HAS_TOSOURCE
JS_FN_TYPE(js_toSource_str, fun_toSource, 0,0, JS_TypeHandlerString), JS_FN_TYPE(js_toSource_str, fun_toSource, 0,0, JS_TypeHandlerString),
#endif #endif
JS_FN_TYPE(js_toString_str, fun_toString, 0,0, JS_TypeHandlerString), 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_apply_str, js_fun_apply, 2,0, JS_TypeHandlerDynamic),
JS_FN_TYPE(js_call_str, js_fun_call, 1,0, type_HandlerMonitored), JS_FN_TYPE(js_call_str, js_fun_call, 1,0, JS_TypeHandlerDynamic),
JS_FN_TYPE("bind", fun_bind, 1,0, JS_TypeHandlerDynamic), JS_FN_TYPE("bind", fun_bind, 1,0, JS_TypeHandlerDynamic),
#if JS_HAS_GENERATORS #if JS_HAS_GENERATORS
JS_FN_TYPE("isGenerator", fun_isGenerator,0,0, JS_TypeHandlerBool), JS_FN_TYPE("isGenerator", fun_isGenerator,0,0, JS_TypeHandlerBool),

View File

@ -1994,7 +1994,6 @@ js_DestroyScriptsToGC(JSContext *cx, JSCompartment *comp)
while ((script = *listp) != NULL) { while ((script = *listp) != NULL) {
*listp = script->u.nextToGC; *listp = script->u.nextToGC;
script->u.nextToGC = NULL; script->u.nextToGC = NULL;
js_DestroyCachedScript(cx, script); js_DestroyCachedScript(cx, script);
} }
} }

View File

@ -120,13 +120,9 @@ GetGCThingTraceKind(const void *thing)
/* Capacity for slotsToThingKind */ /* Capacity for slotsToThingKind */
const size_t SLOTS_TO_THING_KIND_LIMIT = 17; const size_t SLOTS_TO_THING_KIND_LIMIT = 17;
/* /* Get the best kind to use when making an object with the given slot count. */
* 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.
*/
static inline FinalizeKind static inline FinalizeKind
GetGCObjectKind(size_t numSlots, FinalizeKind fallback = FINALIZE_OBJECT0) GetGCObjectKind(size_t numSlots)
{ {
extern FinalizeKind slotsToThingKind[]; extern FinalizeKind slotsToThingKind[];
@ -253,4 +249,5 @@ js_NewGCXML(JSContext *cx)
} }
#endif #endif
#endif /* jsgcinlines_h___ */ #endif /* jsgcinlines_h___ */

View File

@ -46,12 +46,6 @@
#include "jsalloc.h" #include "jsalloc.h"
#include "jstl.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 { namespace js {
/* Integral types for all hash functions. */ /* Integral types for all hash functions. */
@ -1223,8 +1217,4 @@ class HashSet
} /* namespace js */ } /* namespace js */
#ifdef JSHASHTABLE_UNDEFD_MOZALLOC_WRAPPERS
# include "mozilla/mozalloc_macro_wrappers.h"
#endif
#endif #endif

View File

@ -1900,8 +1900,6 @@ namespace reprmeter {
#define POP_COPY_TO(v) v = *--regs.sp #define POP_COPY_TO(v) v = *--regs.sp
#define POP_RETURN_VALUE() regs.fp()->setReturnValue(*--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) \ #define POP_BOOLEAN(cx, vp, b) \
JS_BEGIN_MACRO \ JS_BEGIN_MACRO \
vp = &regs.sp[-1]; \ vp = &regs.sp[-1]; \
@ -2630,6 +2628,7 @@ Interpret(JSContext *cx, StackFrame *entryFrame, uintN inlineCallCount, InterpMo
advance_pc: advance_pc:
regs.pc += len; regs.pc += len;
op = (JSOp) *regs.pc; op = (JSOp) *regs.pc;
do_op: do_op:
CHECK_RECORDER(); CHECK_RECORDER();
LOG_OPCODE(op); LOG_OPCODE(op);
@ -3302,7 +3301,6 @@ BEGIN_CASE(JSOP_SETCONST)
LOAD_ATOM(0, atom); LOAD_ATOM(0, atom);
JSObject &obj = cx->stack.currentVarObj(); JSObject &obj = cx->stack.currentVarObj();
const Value &ref = regs.sp[-1]; const Value &ref = regs.sp[-1];
if (!obj.defineProperty(cx, ATOM_TO_JSID(atom), ref, if (!obj.defineProperty(cx, ATOM_TO_JSID(atom), ref,
PropertyStub, StrictPropertyStub, PropertyStub, StrictPropertyStub,
JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY)) { JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY)) {

View File

@ -402,7 +402,6 @@ GetCustomIterator(JSContext *cx, JSObject *obj, uintN flags, Value *vp)
-1, ObjectValue(*obj), NULL, bytes.ptr()); -1, ObjectValue(*obj), NULL, bytes.ptr());
return false; return false;
} }
return true; return true;
} }

View File

@ -1129,7 +1129,6 @@ js_InitNumberClass(JSContext *cx, JSObject *obj)
JSPROP_PERMANENT | JSPROP_READONLY)) { JSPROP_PERMANENT | JSPROP_READONLY)) {
return NULL; return NULL;
} }
return proto; return proto;
} }

View File

@ -1649,7 +1649,6 @@ js_obj_defineGetter(JSContext *cx, uintN argc, Value *vp)
uintN attrs; uintN attrs;
if (!CheckAccess(cx, obj, id, JSACC_WATCH, &junk, &attrs)) if (!CheckAccess(cx, obj, id, JSACC_WATCH, &junk, &attrs))
return JS_FALSE; return JS_FALSE;
call.rval().setUndefined(); call.rval().setUndefined();
return obj->defineProperty(cx, id, UndefinedValue(), getter, StrictPropertyStub, return obj->defineProperty(cx, id, UndefinedValue(), getter, StrictPropertyStub,
JSPROP_ENUMERATE | JSPROP_GETTER | JSPROP_SHARED); JSPROP_ENUMERATE | JSPROP_GETTER | JSPROP_SHARED);
@ -1684,7 +1683,6 @@ js_obj_defineSetter(JSContext *cx, uintN argc, Value *vp)
uintN attrs; uintN attrs;
if (!CheckAccess(cx, obj, id, JSACC_WATCH, &junk, &attrs)) if (!CheckAccess(cx, obj, id, JSACC_WATCH, &junk, &attrs))
return JS_FALSE; return JS_FALSE;
call.rval().setUndefined(); call.rval().setUndefined();
return obj->defineProperty(cx, id, UndefinedValue(), PropertyStub, setter, return obj->defineProperty(cx, id, UndefinedValue(), PropertyStub, setter,
JSPROP_ENUMERATE | JSPROP_SETTER | JSPROP_SHARED); JSPROP_ENUMERATE | JSPROP_SETTER | JSPROP_SHARED);
@ -2519,10 +2517,7 @@ obj_defineProperty(JSContext* cx, uintN argc, Value* vp)
/* 15.2.3.6 step 4 */ /* 15.2.3.6 step 4 */
JSBool junk; JSBool junk;
if (!js_DefineOwnProperty(cx, obj, nameidr.id(), descval, &junk)) return js_DefineOwnProperty(cx, obj, nameidr.id(), descval, &junk);
return JS_FALSE;
return JS_TRUE;
} }
static bool static bool
@ -3373,7 +3368,7 @@ js_CloneBlockObject(JSContext *cx, JSObject *proto, StackFrame *fp)
JS_ASSERT(proto->isStaticBlock()); JS_ASSERT(proto->isStaticBlock());
size_t count = OBJ_BLOCK_COUNT(cx, proto); 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); js::types::TypeObject *type = proto->getNewType(cx);
if (!type) if (!type)

View File

@ -924,6 +924,7 @@ JSONParseError(JSONParser *jp, JSContext *cx)
static bool static bool
Revive(JSContext *cx, const Value &reviver, Value *vp) Revive(JSContext *cx, const Value &reviver, Value *vp)
{ {
JSObject *obj = NewBuiltinClassInstance(cx, &js_ObjectClass); JSObject *obj = NewBuiltinClassInstance(cx, &js_ObjectClass);
if (!obj) if (!obj)
return false; return false;

View File

@ -51,7 +51,6 @@
#include "jsutil.h" #include "jsutil.h"
#include "jspubtd.h" #include "jspubtd.h"
#include "jsstr.h" #include "jsstr.h"
#include "jsobjinlines.h"
using namespace js; using namespace js;

View File

@ -43,7 +43,6 @@
#include "jsobj.h" #include "jsobj.h"
#include "jsscript.h" #include "jsscript.h"
#include "jsstr.h" #include "jsstr.h"
#include "jsobjinlines.h"
#ifdef __APPLE__ #ifdef __APPLE__
#include "sharkctl.h" #include "sharkctl.h"

View File

@ -56,7 +56,6 @@
using namespace js; using namespace js;
using namespace js::gc; using namespace js::gc;
using namespace js::types;
namespace js { namespace js {
@ -1098,8 +1097,6 @@ JS_FRIEND_API(Class) OuterWindowProxyClass = {
} }
}; };
static const char proxy_type_str[] = "Proxy:new";
JSBool JSBool
proxy_Call(JSContext *cx, uintN argc, Value *vp) proxy_Call(JSContext *cx, uintN argc, Value *vp)
{ {
@ -1463,7 +1460,7 @@ js_InitProxyClass(JSContext *cx, JSObject *obj)
if (!module) if (!module)
return NULL; 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)) if (!type || !module->setTypeAndUniqueShape(cx, type))
return NULL; return NULL;

View File

@ -67,7 +67,7 @@ extern Class regexp_statics_class;
static inline JSObject * static inline JSObject *
regexp_statics_construct(JSContext *cx, GlobalObject *parent) regexp_statics_construct(JSContext *cx, GlobalObject *parent)
{ {
JSObject *obj = NewObject<WithProto::Given>(cx, &regexp_statics_class, parent, NULL); JSObject *obj = NewObject<WithProto::Given>(cx, &regexp_statics_class, NULL, parent);
if (!obj) if (!obj)
return NULL; return NULL;
RegExpStatics *res = cx->new_<RegExpStatics>(); RegExpStatics *res = cx->new_<RegExpStatics>();

View File

@ -1864,7 +1864,6 @@ BuildFlatMatchArray(JSContext *cx, JSString *textstr, const FlatMatch &fm, Value
JSObject *obj = NewSlowEmptyArray(cx); JSObject *obj = NewSlowEmptyArray(cx);
if (!obj) if (!obj)
return false; return false;
vp->setObject(*obj); vp->setObject(*obj);
return obj->defineProperty(cx, INT_TO_JSID(0), StringValue(fm.pattern())) && return obj->defineProperty(cx, INT_TO_JSID(0), StringValue(fm.pattern())) &&

View File

@ -130,8 +130,6 @@ ArrayBuffer::class_finalize(JSContext *cx, JSObject *obj)
} }
} }
static const char arraybuffer_type_str[] = "ArrayBuffer:new";
/* /*
* new ArrayBuffer(byteLength) * new ArrayBuffer(byteLength)
*/ */

View File

@ -197,14 +197,11 @@ BOX_NON_DOUBLE_JSVAL(JSValueType type, uint64 *slot)
{ {
jsval_layout l; jsval_layout l;
JS_ASSERT(type > JSVAL_TYPE_DOUBLE && type <= JSVAL_UPPER_INCL_TYPE_OF_BOXABLE_SET); JS_ASSERT(type > JSVAL_TYPE_DOUBLE && type <= JSVAL_UPPER_INCL_TYPE_OF_BOXABLE_SET);
/*
// FIXME overasserting
JS_ASSERT_IF(type == JSVAL_TYPE_STRING || JS_ASSERT_IF(type == JSVAL_TYPE_STRING ||
type == JSVAL_TYPE_OBJECT || type == JSVAL_TYPE_OBJECT ||
type == JSVAL_TYPE_NONFUNOBJ || type == JSVAL_TYPE_NONFUNOBJ ||
type == JSVAL_TYPE_FUNOBJ, type == JSVAL_TYPE_FUNOBJ,
*(uint32 *)slot != 0); *(uint32 *)slot != 0);
*/
l.s.tag = JSVAL_TYPE_TO_TAG(type & 0xF); l.s.tag = JSVAL_TYPE_TO_TAG(type & 0xF);
/* A 32-bit value in a 64-bit slot always occupies the low-addressed end. */ /* A 32-bit value in a 64-bit slot always occupies the low-addressed end. */
l.s.payload.u32 = *(uint32 *)slot; l.s.payload.u32 = *(uint32 *)slot;
@ -304,14 +301,11 @@ BOX_NON_DOUBLE_JSVAL(JSValueType type, uint64 *slot)
uint32 shift = isI32 * 32; uint32 shift = isI32 * 32;
uint64 mask = ((uint64)-1) >> shift; uint64 mask = ((uint64)-1) >> shift;
uint64 payload = *slot & mask; uint64 payload = *slot & mask;
/*
// FIXME overasserting
JS_ASSERT_IF(type == JSVAL_TYPE_STRING || JS_ASSERT_IF(type == JSVAL_TYPE_STRING ||
type == JSVAL_TYPE_OBJECT || type == JSVAL_TYPE_OBJECT ||
type == JSVAL_TYPE_NONFUNOBJ || type == JSVAL_TYPE_NONFUNOBJ ||
type == JSVAL_TYPE_FUNOBJ, type == JSVAL_TYPE_FUNOBJ,
payload != 0); payload != 0);
*/
l.asBits = payload | JSVAL_TYPE_TO_SHIFTED_TAG(type & 0xF); l.asBits = payload | JSVAL_TYPE_TO_SHIFTED_TAG(type & 0xF);
return l; return l;
} }

View File

@ -223,7 +223,7 @@ namespace_equality(JSContext *cx, JSObject *obj, const Value *v, JSBool *bp)
} }
JS_FRIEND_DATA(Class) js_NamespaceClass = { JS_FRIEND_DATA(Class) js_NamespaceClass = {
js_Namespace_str, "Namespace",
JSCLASS_CONSTRUCT_PROTOTYPE | JSCLASS_CONSTRUCT_PROTOTYPE |
JSCLASS_HAS_RESERVED_SLOTS(JSObject::NAMESPACE_CLASS_RESERVED_SLOTS) | JSCLASS_HAS_RESERVED_SLOTS(JSObject::NAMESPACE_CLASS_RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_Namespace), 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_FRIEND_DATA(Class) js_QNameClass = {
js_QName_str, "QName",
JSCLASS_CONSTRUCT_PROTOTYPE | JSCLASS_CONSTRUCT_PROTOTYPE |
JSCLASS_HAS_RESERVED_SLOTS(JSObject::QNAME_CLASS_RESERVED_SLOTS) | JSCLASS_HAS_RESERVED_SLOTS(JSObject::QNAME_CLASS_RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_QName), JSCLASS_HAS_CACHED_PROTO(JSProto_QName),
@ -7318,7 +7318,6 @@ js_SetDefaultXMLNamespace(JSContext *cx, const Value &v)
return JS_FALSE; return JS_FALSE;
JSObject &varobj = cx->stack.currentVarObj(); JSObject &varobj = cx->stack.currentVarObj();
if (!varobj.defineProperty(cx, JS_DEFAULT_XML_NAMESPACE_ID, ObjectValue(*ns), if (!varobj.defineProperty(cx, JS_DEFAULT_XML_NAMESPACE_ID, ObjectValue(*ns),
PropertyStub, StrictPropertyStub, JSPROP_PERMANENT)) { PropertyStub, StrictPropertyStub, JSPROP_PERMANENT)) {
return JS_FALSE; return JS_FALSE;