mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
bug 686017 - avoid Cell::arenaHeader() on fast paths. r=bhackett1024
This commit is contained in:
parent
49bf432c49
commit
748ef4c024
@ -1031,13 +1031,13 @@ class ScriptAnalysis
|
||||
|
||||
bool hasPushedTypes(const jsbytecode *pc) { return getCode(pc).pushedTypes != NULL; }
|
||||
|
||||
types::TypeBarrier *typeBarriers(uint32 offset) {
|
||||
types::TypeBarrier *typeBarriers(JSContext *cx, uint32 offset) {
|
||||
if (getCode(offset).typeBarriers)
|
||||
pruneTypeBarriers(offset);
|
||||
pruneTypeBarriers(cx, offset);
|
||||
return getCode(offset).typeBarriers;
|
||||
}
|
||||
types::TypeBarrier *typeBarriers(const jsbytecode *pc) {
|
||||
return typeBarriers(pc - script->code);
|
||||
types::TypeBarrier *typeBarriers(JSContext *cx, const jsbytecode *pc) {
|
||||
return typeBarriers(cx, pc - script->code);
|
||||
}
|
||||
void addTypeBarrier(JSContext *cx, const jsbytecode *pc,
|
||||
types::TypeSet *target, types::Type type);
|
||||
@ -1045,7 +1045,7 @@ class ScriptAnalysis
|
||||
types::TypeSet *target, JSObject *singleton, jsid singletonId);
|
||||
|
||||
/* Remove obsolete type barriers at the given offset. */
|
||||
void pruneTypeBarriers(uint32 offset);
|
||||
void pruneTypeBarriers(JSContext *cx, uint32 offset);
|
||||
|
||||
/*
|
||||
* Remove still-active type barriers at the given offset. If 'all' is set,
|
||||
|
@ -1801,7 +1801,7 @@ JS_EnumerateStandardClasses(JSContext *cx, JSObject *obj)
|
||||
* Since ES5 15.1.1.3 undefined can't be deleted.
|
||||
*/
|
||||
atom = rt->atomState.typeAtoms[JSTYPE_VOID];
|
||||
if (!obj->nativeContains(ATOM_TO_JSID(atom)) &&
|
||||
if (!obj->nativeContains(cx, ATOM_TO_JSID(atom)) &&
|
||||
!obj->defineProperty(cx, ATOM_TO_JSID(atom), UndefinedValue(),
|
||||
PropertyStub, StrictPropertyStub,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY)) {
|
||||
@ -1877,7 +1877,7 @@ static JSIdArray *
|
||||
EnumerateIfResolved(JSContext *cx, JSObject *obj, JSAtom *atom, JSIdArray *ida,
|
||||
jsint *ip, JSBool *foundp)
|
||||
{
|
||||
*foundp = obj->nativeContains(ATOM_TO_JSID(atom));
|
||||
*foundp = obj->nativeContains(cx, ATOM_TO_JSID(atom));
|
||||
if (*foundp)
|
||||
ida = AddAtomToArray(cx, atom, ida, ip);
|
||||
return ida;
|
||||
@ -3347,7 +3347,7 @@ JS_AlreadyHasOwnPropertyById(JSContext *cx, JSObject *obj, jsid id, JSBool *foun
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
*foundp = obj->nativeContains(id);
|
||||
*foundp = obj->nativeContains(cx, id);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ JSObject::arrayGetOwnDataElement(JSContext *cx, size_t i, Value *vp)
|
||||
if (!IndexToId(cx, this, i, &hole, &id))
|
||||
return false;
|
||||
|
||||
const Shape *shape = nativeLookup(id);
|
||||
const Shape *shape = nativeLookup(cx, id);
|
||||
if (!shape || !shape->isDataDescriptor())
|
||||
vp->setMagic(JS_ARRAY_HOLE);
|
||||
else
|
||||
@ -1104,7 +1104,7 @@ static bool
|
||||
AddLengthProperty(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
const jsid lengthId = ATOM_TO_JSID(cx->runtime->atomState.lengthAtom);
|
||||
JS_ASSERT(!obj->nativeLookup(lengthId));
|
||||
JS_ASSERT(!obj->nativeLookup(cx, lengthId));
|
||||
|
||||
return obj->addProperty(cx, lengthId, array_length_getter, array_length_setter,
|
||||
SHAPE_INVALID_SLOT, JSPROP_PERMANENT | JSPROP_SHARED, 0, 0);
|
||||
|
@ -1718,7 +1718,7 @@ js_LexicalLookup(JSTreeContext *tc, JSAtom *atom, jsint *slotp, JSStmtInfo *stmt
|
||||
JSObject *obj = stmt->blockBox->object;
|
||||
JS_ASSERT(obj->isStaticBlock());
|
||||
|
||||
const Shape *shape = obj->nativeLookup(ATOM_TO_JSID(atom));
|
||||
const Shape *shape = obj->nativeLookup(tc->parser->context, ATOM_TO_JSID(atom));
|
||||
if (shape) {
|
||||
JS_ASSERT(shape->hasShortID());
|
||||
|
||||
@ -1779,7 +1779,7 @@ LookupCompileTimeConstant(JSContext *cx, JSCodeGenerator *cg, JSAtom *atom,
|
||||
JS_ASSERT(cg->compileAndGo());
|
||||
obj = cg->scopeChain();
|
||||
|
||||
const Shape *shape = obj->nativeLookup(ATOM_TO_JSID(atom));
|
||||
const Shape *shape = obj->nativeLookup(cx, ATOM_TO_JSID(atom));
|
||||
if (shape) {
|
||||
/*
|
||||
* We're compiling code that will be executed immediately,
|
||||
|
@ -1207,7 +1207,7 @@ StackFrame::getValidCalleeObject(JSContext *cx, Value *vp)
|
||||
continue;
|
||||
|
||||
if (thisp->hasMethodBarrier()) {
|
||||
const Shape *shape = thisp->nativeLookup(ATOM_TO_JSID(fun->methodAtom()));
|
||||
const Shape *shape = thisp->nativeLookup(cx, ATOM_TO_JSID(fun->methodAtom()));
|
||||
if (shape) {
|
||||
/*
|
||||
* Two cases follow: the method barrier was not crossed
|
||||
@ -2313,11 +2313,11 @@ LookupInterpretedFunctionPrototype(JSContext *cx, JSObject *funobj)
|
||||
#endif
|
||||
|
||||
jsid id = ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom);
|
||||
const Shape *shape = funobj->nativeLookup(id);
|
||||
const Shape *shape = funobj->nativeLookup(cx, id);
|
||||
if (!shape) {
|
||||
if (!ResolveInterpretedFunctionPrototype(cx, funobj))
|
||||
return NULL;
|
||||
shape = funobj->nativeLookup(id);
|
||||
shape = funobj->nativeLookup(cx, id);
|
||||
}
|
||||
JS_ASSERT(!shape->configurable());
|
||||
JS_ASSERT(shape->isDataDescriptor());
|
||||
|
@ -326,9 +326,9 @@ ClassMethodIsNative(JSContext *cx, JSObject *obj, Class *clasp, jsid methodid, N
|
||||
JS_ASSERT(obj->getClass() == clasp);
|
||||
|
||||
Value v;
|
||||
if (!HasDataProperty(obj, methodid, &v)) {
|
||||
if (!HasDataProperty(cx, obj, methodid, &v)) {
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto || proto->getClass() != clasp || !HasDataProperty(proto, methodid, &v))
|
||||
if (!proto || proto->getClass() != clasp || !HasDataProperty(cx, proto, methodid, &v))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -143,6 +143,15 @@ GetGCObjectKind(size_t numSlots, bool isArray = false)
|
||||
return slotsToThingKind[numSlots];
|
||||
}
|
||||
|
||||
static inline AllocKind
|
||||
GetGCObjectFixedSlotsKind(size_t numFixedSlots)
|
||||
{
|
||||
extern AllocKind slotsToThingKind[];
|
||||
|
||||
JS_ASSERT(numFixedSlots < SLOTS_TO_THING_KIND_LIMIT);
|
||||
return slotsToThingKind[numFixedSlots];
|
||||
}
|
||||
|
||||
static inline bool
|
||||
IsBackgroundAllocKind(AllocKind kind)
|
||||
{
|
||||
|
@ -756,16 +756,16 @@ TypeSet::addFilterPrimitives(JSContext *cx, TypeSet *target, FilterKind filter)
|
||||
|
||||
/* If id is a normal slotful 'own' property of an object, get its shape. */
|
||||
static inline const Shape *
|
||||
GetSingletonShape(JSObject *obj, jsid id)
|
||||
GetSingletonShape(JSContext *cx, JSObject *obj, jsid id)
|
||||
{
|
||||
const Shape *shape = obj->nativeLookup(id);
|
||||
const Shape *shape = obj->nativeLookup(cx, id);
|
||||
if (shape && shape->hasDefaultGetterOrIsMethod() && shape->slot != SHAPE_INVALID_SLOT)
|
||||
return shape;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ScriptAnalysis::pruneTypeBarriers(uint32 offset)
|
||||
ScriptAnalysis::pruneTypeBarriers(JSContext *cx, uint32 offset)
|
||||
{
|
||||
TypeBarrier **pbarrier = &getCode(offset).typeBarriers;
|
||||
while (*pbarrier) {
|
||||
@ -777,7 +777,7 @@ ScriptAnalysis::pruneTypeBarriers(uint32 offset)
|
||||
}
|
||||
if (barrier->singleton) {
|
||||
JS_ASSERT(barrier->type.isPrimitive(JSVAL_TYPE_UNDEFINED));
|
||||
const Shape *shape = GetSingletonShape(barrier->singleton, barrier->singletonId);
|
||||
const Shape *shape = GetSingletonShape(cx, barrier->singleton, barrier->singletonId);
|
||||
if (shape && !barrier->singleton->nativeGetSlot(shape->slot).isUndefined()) {
|
||||
/*
|
||||
* When we analyzed the script the singleton had an 'own'
|
||||
@ -805,7 +805,7 @@ static const uint32 BARRIER_OBJECT_LIMIT = 10;
|
||||
|
||||
void ScriptAnalysis::breakTypeBarriers(JSContext *cx, uint32 offset, bool all)
|
||||
{
|
||||
pruneTypeBarriers(offset);
|
||||
pruneTypeBarriers(cx, offset);
|
||||
|
||||
TypeBarrier **pbarrier = &getCode(offset).typeBarriers;
|
||||
while (*pbarrier) {
|
||||
@ -1004,7 +1004,7 @@ PropertyAccess(JSContext *cx, JSScript *script, jsbytecode *pc, TypeObject *obje
|
||||
* to remove the barrier after the property becomes defined,
|
||||
* even if no undefined value is ever observed at pc.
|
||||
*/
|
||||
const Shape *shape = GetSingletonShape(object->singleton, id);
|
||||
const Shape *shape = GetSingletonShape(cx, object->singleton, id);
|
||||
if (shape && object->singleton->nativeGetSlot(shape->slot).isUndefined())
|
||||
script->analysis()->addSingletonTypeBarrier(cx, pc, target, object->singleton, id);
|
||||
}
|
||||
@ -2728,7 +2728,7 @@ TypeObject::addProperty(JSContext *cx, jsid id, Property **pprop)
|
||||
shape = shape->previous();
|
||||
}
|
||||
} else {
|
||||
const Shape *shape = singleton->nativeLookup(id);
|
||||
const Shape *shape = singleton->nativeLookup(cx, id);
|
||||
if (shape)
|
||||
UpdatePropertyType(cx, &base->types, singleton, shape, false);
|
||||
}
|
||||
|
@ -3755,9 +3755,9 @@ BEGIN_CASE(JSOP_SETMETHOD)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (entry->directHit()) {
|
||||
JS_ASSERT(obj->nativeContains(*shape));
|
||||
JS_ASSERT(obj->nativeContains(cx, *shape));
|
||||
} else {
|
||||
JS_ASSERT(obj2->nativeContains(*shape));
|
||||
JS_ASSERT(obj2->nativeContains(cx, *shape));
|
||||
JS_ASSERT(entry->vcapTag() == 1);
|
||||
JS_ASSERT(entry->kshape != entry->vshape());
|
||||
JS_ASSERT(!shape->hasSlot());
|
||||
|
@ -3117,7 +3117,7 @@ js_CreateThisFromTrace(JSContext *cx, JSObject *ctor, uintN protoSlot)
|
||||
JS_ASSERT(ctor->isFunction());
|
||||
JS_ASSERT(ctor->getFunctionPrivate()->isInterpreted());
|
||||
jsid id = ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom);
|
||||
const Shape *shape = ctor->nativeLookup(id);
|
||||
const Shape *shape = ctor->nativeLookup(cx, id);
|
||||
JS_ASSERT(shape->slot == protoSlot);
|
||||
JS_ASSERT(!shape->configurable());
|
||||
JS_ASSERT(!shape->isMethod());
|
||||
@ -4115,7 +4115,7 @@ DefineStandardSlot(JSContext *cx, JSObject *obj, JSProtoKey key, JSAtom *atom,
|
||||
if (!obj->ensureClassReservedSlots(cx))
|
||||
return false;
|
||||
|
||||
const Shape *shape = obj->nativeLookup(id);
|
||||
const Shape *shape = obj->nativeLookup(cx, id);
|
||||
if (!shape) {
|
||||
uint32 slot = 2 * JSProto_LIMIT + key;
|
||||
if (!js_SetReservedSlot(cx, obj, slot, v))
|
||||
@ -4965,7 +4965,7 @@ PurgeProtoChain(JSContext *cx, JSObject *obj, jsid id)
|
||||
obj = obj->getProto();
|
||||
continue;
|
||||
}
|
||||
shape = obj->nativeLookup(id);
|
||||
shape = obj->nativeLookup(cx, id);
|
||||
if (shape) {
|
||||
PCMETER(JS_PROPERTY_CACHE(cx).pcpurges++);
|
||||
obj->shadowingShapeChange(cx, *shape);
|
||||
@ -5204,7 +5204,7 @@ DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, const Value &value,
|
||||
}
|
||||
}
|
||||
|
||||
if (const Shape *existingShape = obj->nativeLookup(id)) {
|
||||
if (const Shape *existingShape = obj->nativeLookup(cx, id)) {
|
||||
if (existingShape->hasSlot())
|
||||
AbortRecordingIfUnexpectedGlobalWrite(cx, obj, existingShape->slot);
|
||||
|
||||
@ -5356,7 +5356,7 @@ CallResolveOp(JSContext *cx, JSObject *start, JSObject *obj, jsid id, uintN flag
|
||||
}
|
||||
|
||||
if (!obj->nativeEmpty()) {
|
||||
if (const Shape *shape = obj->nativeLookup(id)) {
|
||||
if (const Shape *shape = obj->nativeLookup(cx, id)) {
|
||||
*objp = obj;
|
||||
*propp = (JSProperty *) shape;
|
||||
}
|
||||
@ -5375,7 +5375,7 @@ LookupPropertyWithFlagsInline(JSContext *cx, JSObject *obj, jsid id, uintN flags
|
||||
/* Search scopes starting with obj and following the prototype link. */
|
||||
JSObject *start = obj;
|
||||
while (true) {
|
||||
const Shape *shape = obj->nativeLookup(id);
|
||||
const Shape *shape = obj->nativeLookup(cx, id);
|
||||
if (shape) {
|
||||
*objp = obj;
|
||||
*propp = (JSProperty *) shape;
|
||||
@ -5670,7 +5670,7 @@ js_NativeGetInline(JSContext *cx, JSObject *receiver, JSObject *obj, JSObject *p
|
||||
|
||||
if (pobj->containsSlot(slot) &&
|
||||
(JS_LIKELY(cx->runtime->propertyRemovals == sample) ||
|
||||
pobj->nativeContains(*shape))) {
|
||||
pobj->nativeContains(cx, *shape))) {
|
||||
if (!pobj->methodWriteBarrier(cx, *shape, *vp))
|
||||
return false;
|
||||
pobj->nativeSetSlot(slot, *vp);
|
||||
@ -5737,7 +5737,7 @@ js_NativeSet(JSContext *cx, JSObject *obj, const Shape *shape, bool added, bool
|
||||
|
||||
if (obj->containsSlot(slot) &&
|
||||
(JS_LIKELY(cx->runtime->propertyRemovals == sample) ||
|
||||
obj->nativeContains(*shape))) {
|
||||
obj->nativeContains(cx, *shape))) {
|
||||
if (!added) {
|
||||
AbortRecordingIfUnexpectedGlobalWrite(cx, obj, slot);
|
||||
if (!obj->methodWriteBarrier(cx, *shape, *vp))
|
||||
@ -6348,9 +6348,9 @@ js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool str
|
||||
namespace js {
|
||||
|
||||
bool
|
||||
HasDataProperty(JSObject *obj, jsid methodid, Value *vp)
|
||||
HasDataProperty(JSContext *cx, JSObject *obj, jsid methodid, Value *vp)
|
||||
{
|
||||
if (const Shape *shape = obj->nativeLookup(methodid)) {
|
||||
if (const Shape *shape = obj->nativeLookup(cx, methodid)) {
|
||||
if (shape->hasDefaultGetterOrIsMethod() && obj->containsSlot(shape->slot)) {
|
||||
*vp = obj->nativeGetSlot(shape->slot);
|
||||
return true;
|
||||
|
@ -425,11 +425,11 @@ struct JSObject : js::gc::Cell {
|
||||
public:
|
||||
inline const js::Shape *lastProperty() const;
|
||||
|
||||
inline js::Shape **nativeSearch(jsid id, bool adding = false);
|
||||
inline const js::Shape *nativeLookup(jsid id);
|
||||
inline js::Shape **nativeSearch(JSContext *cx, jsid id, bool adding = false);
|
||||
inline const js::Shape *nativeLookup(JSContext *cx, jsid id);
|
||||
|
||||
inline bool nativeContains(jsid id);
|
||||
inline bool nativeContains(const js::Shape &shape);
|
||||
inline bool nativeContains(JSContext *cx, jsid id);
|
||||
inline bool nativeContains(JSContext *cx, const js::Shape &shape);
|
||||
|
||||
enum {
|
||||
DELEGATE = 0x01,
|
||||
@ -1984,7 +1984,7 @@ namespace js {
|
||||
* store the property value in *vp.
|
||||
*/
|
||||
extern bool
|
||||
HasDataProperty(JSObject *obj, jsid methodid, js::Value *vp);
|
||||
HasDataProperty(JSContext *cx, JSObject *obj, jsid methodid, js::Value *vp);
|
||||
|
||||
extern JSBool
|
||||
CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
|
||||
|
@ -143,7 +143,7 @@ JSObject::getProperty(JSContext *cx, JSObject *receiver, jsid id, js::Value *vp)
|
||||
} else {
|
||||
if (!js_GetProperty(cx, this, receiver, id, vp))
|
||||
return false;
|
||||
JS_ASSERT_IF(!hasSingletonType() && nativeContains(js_CheckForStringIndex(id)),
|
||||
JS_ASSERT_IF(!hasSingletonType() && nativeContains(cx, js_CheckForStringIndex(id)),
|
||||
js::types::TypeHasProperty(cx, type(), id, *vp));
|
||||
}
|
||||
return true;
|
||||
@ -253,7 +253,7 @@ JSObject::methodReadBarrier(JSContext *cx, const js::Shape &shape, js::Value *vp
|
||||
{
|
||||
JS_ASSERT(canHaveMethodBarrier());
|
||||
JS_ASSERT(hasMethodBarrier());
|
||||
JS_ASSERT(nativeContains(shape));
|
||||
JS_ASSERT(nativeContains(cx, shape));
|
||||
JS_ASSERT(shape.isMethod());
|
||||
JS_ASSERT(shape.methodObject() == vp->toObject());
|
||||
JS_ASSERT(shape.writable());
|
||||
@ -1007,28 +1007,28 @@ JSObject::setOwnShape(uint32 s)
|
||||
}
|
||||
|
||||
inline js::Shape **
|
||||
JSObject::nativeSearch(jsid id, bool adding)
|
||||
JSObject::nativeSearch(JSContext *cx, jsid id, bool adding)
|
||||
{
|
||||
return js::Shape::search(compartment()->rt, &lastProp, id, adding);
|
||||
return js::Shape::search(cx, &lastProp, id, adding);
|
||||
}
|
||||
|
||||
inline const js::Shape *
|
||||
JSObject::nativeLookup(jsid id)
|
||||
JSObject::nativeLookup(JSContext *cx, jsid id)
|
||||
{
|
||||
JS_ASSERT(isNative());
|
||||
return SHAPE_FETCH(nativeSearch(id));
|
||||
return SHAPE_FETCH(nativeSearch(cx, id));
|
||||
}
|
||||
|
||||
inline bool
|
||||
JSObject::nativeContains(jsid id)
|
||||
JSObject::nativeContains(JSContext *cx, jsid id)
|
||||
{
|
||||
return nativeLookup(id) != NULL;
|
||||
return nativeLookup(cx, id) != NULL;
|
||||
}
|
||||
|
||||
inline bool
|
||||
JSObject::nativeContains(const js::Shape &shape)
|
||||
JSObject::nativeContains(JSContext *cx, const js::Shape &shape)
|
||||
{
|
||||
return nativeLookup(shape.propid) == &shape;
|
||||
return nativeLookup(cx, shape.propid) == &shape;
|
||||
}
|
||||
|
||||
inline const js::Shape *
|
||||
@ -1567,7 +1567,12 @@ CopyInitializerObject(JSContext *cx, JSObject *baseobj, types::TypeObject *type)
|
||||
JS_ASSERT(baseobj->getClass() == &ObjectClass);
|
||||
JS_ASSERT(!baseobj->inDictionaryMode());
|
||||
|
||||
JSObject *obj = NewBuiltinClassInstance(cx, &ObjectClass, baseobj->getAllocKind());
|
||||
gc::AllocKind kind = gc::GetGCObjectFixedSlotsKind(baseobj->numFixedSlots());
|
||||
#ifdef JS_THREADSAFE
|
||||
kind = gc::GetBackgroundAllocKind(kind);
|
||||
#endif
|
||||
JS_ASSERT(kind == baseobj->getAllocKind());
|
||||
JSObject *obj = NewBuiltinClassInstance(cx, &ObjectClass, kind);
|
||||
|
||||
if (!obj || !obj->ensureSlots(cx, baseobj->numSlots()))
|
||||
return NULL;
|
||||
@ -1589,7 +1594,7 @@ DefineConstructorAndPrototype(JSContext *cx, GlobalObject *global,
|
||||
JS_ASSERT(proto);
|
||||
|
||||
jsid id = ATOM_TO_JSID(cx->runtime->atomState.classAtoms[key]);
|
||||
JS_ASSERT(!global->nativeLookup(id));
|
||||
JS_ASSERT(!global->nativeLookup(cx, id));
|
||||
|
||||
/* Set these first in case AddTypePropertyId looks for this class. */
|
||||
global->setSlot(key, ObjectValue(*ctor));
|
||||
|
@ -70,7 +70,7 @@ PropertyCache::fill(JSContext *cx, JSObject *obj, uintN scopeIndex, JSObject *po
|
||||
* Check for fill from js_SetPropertyHelper where the setter removed shape
|
||||
* from pobj (via unwatch or delete, e.g.).
|
||||
*/
|
||||
if (!pobj->nativeContains(*shape)) {
|
||||
if (!pobj->nativeContains(cx, *shape)) {
|
||||
PCMETER(oddfills++);
|
||||
return JS_NO_PROP_CACHE_FILL;
|
||||
}
|
||||
@ -399,7 +399,7 @@ PropertyCache::fullTest(JSContext *cx, jsbytecode *pc, JSObject **objp, JSObject
|
||||
jsid id = ATOM_TO_JSID(atom);
|
||||
|
||||
id = js_CheckForStringIndex(id);
|
||||
JS_ASSERT(pobj->nativeContains(id));
|
||||
JS_ASSERT(pobj->nativeContains(cx, id));
|
||||
#endif
|
||||
*pobjp = pobj;
|
||||
return NULL;
|
||||
|
@ -783,17 +783,17 @@ JSObject::initRegExp(JSContext *cx, js::RegExp *re)
|
||||
JS_ASSERT(!nativeEmpty());
|
||||
}
|
||||
|
||||
JS_ASSERT(nativeLookup(ATOM_TO_JSID(cx->runtime->atomState.lastIndexAtom))->slot ==
|
||||
JS_ASSERT(nativeLookup(cx, ATOM_TO_JSID(cx->runtime->atomState.lastIndexAtom))->slot ==
|
||||
JSObject::JSSLOT_REGEXP_LAST_INDEX);
|
||||
JS_ASSERT(nativeLookup(ATOM_TO_JSID(cx->runtime->atomState.sourceAtom))->slot ==
|
||||
JS_ASSERT(nativeLookup(cx, ATOM_TO_JSID(cx->runtime->atomState.sourceAtom))->slot ==
|
||||
JSObject::JSSLOT_REGEXP_SOURCE);
|
||||
JS_ASSERT(nativeLookup(ATOM_TO_JSID(cx->runtime->atomState.globalAtom))->slot ==
|
||||
JS_ASSERT(nativeLookup(cx, ATOM_TO_JSID(cx->runtime->atomState.globalAtom))->slot ==
|
||||
JSObject::JSSLOT_REGEXP_GLOBAL);
|
||||
JS_ASSERT(nativeLookup(ATOM_TO_JSID(cx->runtime->atomState.ignoreCaseAtom))->slot ==
|
||||
JS_ASSERT(nativeLookup(cx, ATOM_TO_JSID(cx->runtime->atomState.ignoreCaseAtom))->slot ==
|
||||
JSObject::JSSLOT_REGEXP_IGNORE_CASE);
|
||||
JS_ASSERT(nativeLookup(ATOM_TO_JSID(cx->runtime->atomState.multilineAtom))->slot ==
|
||||
JS_ASSERT(nativeLookup(cx, ATOM_TO_JSID(cx->runtime->atomState.multilineAtom))->slot ==
|
||||
JSObject::JSSLOT_REGEXP_MULTILINE);
|
||||
JS_ASSERT(nativeLookup(ATOM_TO_JSID(cx->runtime->atomState.stickyAtom))->slot ==
|
||||
JS_ASSERT(nativeLookup(cx, ATOM_TO_JSID(cx->runtime->atomState.stickyAtom))->slot ==
|
||||
JSObject::JSSLOT_REGEXP_STICKY);
|
||||
|
||||
setPrivate(re);
|
||||
|
@ -170,9 +170,10 @@ PropertyTable::init(JSRuntime *rt, Shape *lastProp)
|
||||
}
|
||||
|
||||
bool
|
||||
Shape::hashify(JSRuntime *rt)
|
||||
Shape::hashify(JSContext *cx)
|
||||
{
|
||||
JS_ASSERT(!hasTable());
|
||||
JSRuntime *rt = cx->runtime;
|
||||
PropertyTable *table = rt->new_<PropertyTable>(entryCount());
|
||||
if (!table)
|
||||
return false;
|
||||
@ -366,7 +367,7 @@ Shape::getChild(JSContext *cx, const js::Shape &child, Shape **listp)
|
||||
newShape->setTable(table);
|
||||
} else {
|
||||
if (!newShape->hasTable())
|
||||
newShape->hashify(cx->runtime);
|
||||
newShape->hashify(cx);
|
||||
}
|
||||
return newShape;
|
||||
}
|
||||
@ -493,7 +494,7 @@ Shape::newDictionaryList(JSContext *cx, Shape **listp)
|
||||
root->listp = listp;
|
||||
|
||||
JS_ASSERT(root->inDictionary());
|
||||
root->hashify(cx->runtime);
|
||||
root->hashify(cx);
|
||||
return root;
|
||||
}
|
||||
|
||||
@ -635,7 +636,7 @@ JSObject::addProperty(JSContext *cx, jsid id,
|
||||
NormalizeGetterAndSetter(cx, this, id, attrs, flags, getter, setter);
|
||||
|
||||
/* Search for id with adding = true in order to claim its entry. */
|
||||
Shape **spp = nativeSearch(id, true);
|
||||
Shape **spp = nativeSearch(cx, id, true);
|
||||
JS_ASSERT(!SHAPE_FETCH(spp));
|
||||
return addPropertyInternal(cx, id, getter, setter, slot, attrs, flags, shortid, spp);
|
||||
}
|
||||
@ -654,7 +655,7 @@ JSObject::addPropertyInternal(JSContext *cx, jsid id,
|
||||
if (lastProp->entryCount() >= PropertyTree::MAX_HEIGHT) {
|
||||
if (!toDictionaryMode(cx))
|
||||
return NULL;
|
||||
spp = nativeSearch(id, true);
|
||||
spp = nativeSearch(cx, id, true);
|
||||
table = lastProp->getTable();
|
||||
}
|
||||
} else if (lastProp->hasTable()) {
|
||||
@ -742,7 +743,7 @@ JSObject::putProperty(JSContext *cx, jsid id,
|
||||
NormalizeGetterAndSetter(cx, this, id, attrs, flags, getter, setter);
|
||||
|
||||
/* Search for id in order to claim its entry if table has been allocated. */
|
||||
Shape **spp = nativeSearch(id, true);
|
||||
Shape **spp = nativeSearch(cx, id, true);
|
||||
Shape *shape = SHAPE_FETCH(spp);
|
||||
if (!shape) {
|
||||
/*
|
||||
@ -788,7 +789,7 @@ JSObject::putProperty(JSContext *cx, jsid id,
|
||||
if (shape != lastProp && !inDictionaryMode()) {
|
||||
if (!toDictionaryMode(cx))
|
||||
return NULL;
|
||||
spp = nativeSearch(shape->propid);
|
||||
spp = nativeSearch(cx, shape->propid);
|
||||
shape = SHAPE_FETCH(spp);
|
||||
}
|
||||
|
||||
@ -893,7 +894,7 @@ JSObject::changeProperty(JSContext *cx, const Shape *shape, uintN attrs, uintN m
|
||||
{
|
||||
JS_ASSERT_IF(inDictionaryMode(), !lastProp->frozen());
|
||||
JS_ASSERT(!JSID_IS_VOID(shape->propid));
|
||||
JS_ASSERT(nativeContains(*shape));
|
||||
JS_ASSERT(nativeContains(cx, *shape));
|
||||
|
||||
attrs |= shape->attrs & mask;
|
||||
|
||||
@ -964,7 +965,7 @@ JSObject::changeProperty(JSContext *cx, const Shape *shape, uintN attrs, uintN m
|
||||
if (newShape) {
|
||||
JS_ASSERT(newShape == lastProp);
|
||||
if (newShape->hasTable()) {
|
||||
Shape **spp = nativeSearch(shape->propid);
|
||||
Shape **spp = nativeSearch(cx, shape->propid);
|
||||
JS_ASSERT(SHAPE_FETCH(spp) == newShape);
|
||||
}
|
||||
}
|
||||
@ -989,7 +990,7 @@ JSObject::changeProperty(JSContext *cx, const Shape *shape, uintN attrs, uintN m
|
||||
bool
|
||||
JSObject::removeProperty(JSContext *cx, jsid id)
|
||||
{
|
||||
Shape **spp = nativeSearch(id);
|
||||
Shape **spp = nativeSearch(cx, id);
|
||||
Shape *shape = SHAPE_FETCH(spp);
|
||||
if (!shape)
|
||||
return true;
|
||||
@ -1006,7 +1007,7 @@ JSObject::removeProperty(JSContext *cx, jsid id)
|
||||
if (shape != lastProp && !inDictionaryMode()) {
|
||||
if (!toDictionaryMode(cx))
|
||||
return false;
|
||||
spp = nativeSearch(shape->propid);
|
||||
spp = nativeSearch(cx, shape->propid);
|
||||
shape = SHAPE_FETCH(spp);
|
||||
}
|
||||
|
||||
@ -1036,7 +1037,7 @@ JSObject::removeProperty(JSContext *cx, jsid id)
|
||||
*/
|
||||
const Shape *aprop = lastProp;
|
||||
for (int n = 50; --n >= 0 && aprop->parent; aprop = aprop->parent)
|
||||
JS_ASSERT_IF(aprop != shape, nativeContains(*aprop));
|
||||
JS_ASSERT_IF(aprop != shape, nativeContains(cx, *aprop));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ struct Shape : public js::gc::Cell
|
||||
else to obj->lastProp */
|
||||
};
|
||||
|
||||
static inline js::Shape **search(JSRuntime *rt, js::Shape **startp, jsid id,
|
||||
static inline js::Shape **search(JSContext *cx, js::Shape **startp, jsid id,
|
||||
bool adding = false);
|
||||
static js::Shape *newDictionaryShape(JSContext *cx, const js::Shape &child, js::Shape **listp);
|
||||
static js::Shape *newDictionaryList(JSContext *cx, js::Shape **listp);
|
||||
@ -377,7 +377,7 @@ struct Shape : public js::gc::Cell
|
||||
|
||||
js::Shape *getChild(JSContext *cx, const js::Shape &child, js::Shape **listp);
|
||||
|
||||
bool hashify(JSRuntime *rt);
|
||||
bool hashify(JSContext *cx);
|
||||
|
||||
void setTable(js::PropertyTable *t) const {
|
||||
JS_ASSERT_IF(t && t->freelist != SHAPE_INVALID_SLOT, t->freelist < slotSpan);
|
||||
@ -704,14 +704,14 @@ js_GenerateShape(JSContext *cx);
|
||||
namespace js {
|
||||
|
||||
JS_ALWAYS_INLINE js::Shape **
|
||||
Shape::search(JSRuntime *rt, js::Shape **startp, jsid id, bool adding)
|
||||
Shape::search(JSContext *cx, js::Shape **startp, jsid id, bool adding)
|
||||
{
|
||||
js::Shape *start = *startp;
|
||||
if (start->hasTable())
|
||||
return start->getTable()->search(id, adding);
|
||||
|
||||
if (start->numLinearSearches == PropertyTable::MAX_LINEAR_SEARCHES) {
|
||||
if (start->hashify(rt))
|
||||
if (start->hashify(cx))
|
||||
return start->getTable()->search(id, adding);
|
||||
/* OOM! Don't increment numLinearSearches, to keep hasTable() false. */
|
||||
JS_ASSERT(!start->hasTable());
|
||||
|
@ -164,7 +164,7 @@ StringObject::init(JSContext *cx, JSString *str)
|
||||
}
|
||||
JS_ASSERT(*shapep == lastProperty());
|
||||
JS_ASSERT(!nativeEmpty());
|
||||
JS_ASSERT(nativeLookup(ATOM_TO_JSID(cx->runtime->atomState.lengthAtom))->slot == LENGTH_SLOT);
|
||||
JS_ASSERT(nativeLookup(cx, ATOM_TO_JSID(cx->runtime->atomState.lengthAtom))->slot == LENGTH_SLOT);
|
||||
|
||||
setStringThis(str);
|
||||
return true;
|
||||
|
@ -88,7 +88,7 @@ Bindings::lookup(JSContext *cx, JSAtom *name, uintN *indexp) const
|
||||
return NONE;
|
||||
|
||||
Shape *shape =
|
||||
SHAPE_FETCH(Shape::search(cx->runtime, const_cast<Shape **>(&lastBinding),
|
||||
SHAPE_FETCH(Shape::search(cx, const_cast<Shape **>(&lastBinding),
|
||||
ATOM_TO_JSID(name)));
|
||||
if (!shape)
|
||||
return NONE;
|
||||
|
@ -11556,7 +11556,7 @@ TraceRecorder::callNative(uintN argc, JSOp mode)
|
||||
if (js_GetClassPrototype(cx, NULL, JSProto_RegExp, &proto)) {
|
||||
Value pval;
|
||||
jsid id = ATOM_TO_JSID(cx->runtime->atomState.testAtom);
|
||||
if (HasDataProperty(proto, id, &pval) &&
|
||||
if (HasDataProperty(cx, proto, id, &pval) &&
|
||||
IsNativeFunction(pval, js_regexp_test))
|
||||
{
|
||||
vp[0] = pval;
|
||||
@ -12065,7 +12065,7 @@ SafeLookup(JSContext *cx, JSObject* obj, jsid id, JSObject** pobjp, const Shape*
|
||||
if (obj->getOps()->lookupProperty)
|
||||
return false;
|
||||
|
||||
if (const Shape *shape = obj->nativeLookup(id)) {
|
||||
if (const Shape *shape = obj->nativeLookup(cx, id)) {
|
||||
*pobjp = obj;
|
||||
*shapep = shape;
|
||||
return true;
|
||||
@ -12136,7 +12136,7 @@ TraceRecorder::nativeSet(JSObject* obj, LIns* obj_ins, const Shape* shape,
|
||||
{
|
||||
uint32 slot = shape->slot;
|
||||
JS_ASSERT((slot != SHAPE_INVALID_SLOT) == shape->hasSlot());
|
||||
JS_ASSERT_IF(shape->hasSlot(), obj->nativeContains(*shape));
|
||||
JS_ASSERT_IF(shape->hasSlot(), obj->nativeContains(cx, *shape));
|
||||
|
||||
/*
|
||||
* We do not trace assignment to properties that have both a non-default
|
||||
@ -12181,7 +12181,7 @@ TraceRecorder::nativeSet(JSObject* obj, LIns* obj_ins, const Shape* shape,
|
||||
// Because the trace is type-specialized to the global object's
|
||||
// slots, no run-time check is needed. Avoid recording a global
|
||||
// shape change, though.
|
||||
JS_ASSERT(obj->nativeContains(*shape));
|
||||
JS_ASSERT(obj->nativeContains(cx, *shape));
|
||||
if (IsFunctionObject(obj->getSlot(slot)))
|
||||
RETURN_STOP("can't trace set of function-valued global property");
|
||||
} else {
|
||||
@ -12521,7 +12521,7 @@ TraceRecorder::recordInitPropertyOp(jsbytecode op)
|
||||
// shape or because the id appears more than once in the initializer), just
|
||||
// set it. The existing property can't be an accessor property: we wouldn't
|
||||
// get here, as JSOP_SETTER can't be recorded.
|
||||
if (const Shape* shape = obj->nativeLookup(id)) {
|
||||
if (const Shape* shape = obj->nativeLookup(cx, id)) {
|
||||
// Don't assign a bare (non-cloned) function to an ordinary or method
|
||||
// property. The opposite case, assigning some other value to a method,
|
||||
// is OK. nativeSet emits code that trips the write barrier.
|
||||
@ -14179,7 +14179,7 @@ TraceRecorder::propTail(JSObject* obj, LIns* obj_ins, JSObject* obj2, PCVal pcva
|
||||
|
||||
if (pcval.isShape()) {
|
||||
shape = pcval.toShape();
|
||||
JS_ASSERT(obj2->nativeContains(*shape));
|
||||
JS_ASSERT(obj2->nativeContains(cx, *shape));
|
||||
|
||||
if (setflags && !shape->hasDefaultSetter())
|
||||
RETURN_STOP("non-stub setter");
|
||||
|
@ -144,7 +144,7 @@ WatchpointMap::triggerWatchpoint(JSContext *cx, JSObject *obj, jsid id, Value *v
|
||||
Value old;
|
||||
old.setUndefined();
|
||||
if (obj->isNative()) {
|
||||
if (const Shape *shape = obj->nativeLookup(id)) {
|
||||
if (const Shape *shape = obj->nativeLookup(cx, id)) {
|
||||
uint32 slot = shape->slot;
|
||||
if (obj->containsSlot(slot)) {
|
||||
if (shape->isMethod()) {
|
||||
@ -157,7 +157,7 @@ WatchpointMap::triggerWatchpoint(JSContext *cx, JSObject *obj, jsid id, Value *v
|
||||
Value method = ObjectValue(shape->methodObject());
|
||||
if (!obj->methodReadBarrier(cx, *shape, &method))
|
||||
return false;
|
||||
shape = obj->nativeLookup(id);
|
||||
shape = obj->nativeLookup(cx, id);
|
||||
JS_ASSERT(shape->isDataDescriptor());
|
||||
JS_ASSERT(!shape->isMethod());
|
||||
old = method;
|
||||
|
@ -259,7 +259,7 @@ mjit::Compiler::scanInlineCalls(uint32 index, uint32 depth)
|
||||
continue;
|
||||
|
||||
/* Not inlining at monitored call sites or those with type barriers. */
|
||||
if (code->monitoredTypes || code->monitoredTypesReturn || analysis->typeBarriers(pc) != NULL)
|
||||
if (code->monitoredTypes || code->monitoredTypesReturn || analysis->typeBarriers(cx, pc) != NULL)
|
||||
continue;
|
||||
|
||||
uint32 argc = GET_ARGC(pc);
|
||||
@ -5927,7 +5927,7 @@ mjit::Compiler::jsop_getgname(uint32 index)
|
||||
* then bake its address into the jitcode and guard against future
|
||||
* reallocation of the global object's slots.
|
||||
*/
|
||||
const js::Shape *shape = globalObj->nativeLookup(ATOM_TO_JSID(atom));
|
||||
const js::Shape *shape = globalObj->nativeLookup(cx, ATOM_TO_JSID(atom));
|
||||
if (shape && shape->hasDefaultGetterOrIsMethod() && shape->hasSlot()) {
|
||||
Value *value = &globalObj->getSlotRef(shape->slot);
|
||||
if (!value->isUndefined() &&
|
||||
@ -6150,7 +6150,7 @@ mjit::Compiler::jsop_setgname(JSAtom *atom, bool usePropertyCache, bool popGuara
|
||||
types::TypeSet *types = globalObj->getType(cx)->getProperty(cx, id, false);
|
||||
if (!types)
|
||||
return;
|
||||
const js::Shape *shape = globalObj->nativeLookup(ATOM_TO_JSID(atom));
|
||||
const js::Shape *shape = globalObj->nativeLookup(cx, ATOM_TO_JSID(atom));
|
||||
if (shape && !shape->isMethod() && shape->hasDefaultSetter() &&
|
||||
shape->writable() && shape->hasSlot() &&
|
||||
!types->isOwnProperty(cx, globalObj->getType(cx), true)) {
|
||||
@ -7241,7 +7241,7 @@ mjit::Compiler::hasTypeBarriers(jsbytecode *pc)
|
||||
return js_CodeSpec[*pc].format & JOF_TYPESET;
|
||||
#endif
|
||||
|
||||
return analysis->typeBarriers(pc) != NULL;
|
||||
return analysis->typeBarriers(cx, pc) != NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -87,7 +87,7 @@ ic::GetGlobalName(VMFrame &f, ic::GetGlobalNameIC *ic)
|
||||
JSAtom *atom = f.script()->getAtom(GET_INDEX(f.pc()));
|
||||
jsid id = ATOM_TO_JSID(atom);
|
||||
|
||||
const Shape *shape = obj->nativeLookup(id);
|
||||
const Shape *shape = obj->nativeLookup(f.cx, id);
|
||||
if (!shape ||
|
||||
!shape->hasDefaultGetterOrIsMethod() ||
|
||||
!shape->hasSlot())
|
||||
@ -322,7 +322,7 @@ ic::SetGlobalName(VMFrame &f, ic::SetGlobalNameIC *ic)
|
||||
JSObject *obj = f.fp()->scopeChain().getGlobal();
|
||||
JSScript *script = f.script();
|
||||
JSAtom *atom = script->getAtom(GET_INDEX(f.pc()));
|
||||
const Shape *shape = obj->nativeLookup(ATOM_TO_JSID(atom));
|
||||
const Shape *shape = obj->nativeLookup(f.cx, ATOM_TO_JSID(atom));
|
||||
|
||||
LookupStatus status = UpdateSetGlobalName(f, ic, obj, shape);
|
||||
if (status == Lookup_Error)
|
||||
|
@ -182,9 +182,9 @@ stubs::SetName(VMFrame &f, JSAtom *origAtom)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (entry->directHit()) {
|
||||
JS_ASSERT(obj->nativeContains(*shape));
|
||||
JS_ASSERT(obj->nativeContains(cx, *shape));
|
||||
} else {
|
||||
JS_ASSERT(obj2->nativeContains(*shape));
|
||||
JS_ASSERT(obj2->nativeContains(cx, *shape));
|
||||
JS_ASSERT(entry->vcapTag() == 1);
|
||||
JS_ASSERT(entry->kshape != entry->vshape());
|
||||
JS_ASSERT(!shape->hasSlot());
|
||||
|
Loading…
Reference in New Issue
Block a user