Bug 875449 - Rename ListBase to DOMProxy, since these proxies are used for all sorts of objects that aren't in any way like lists. r=djvj

This commit is contained in:
Anand Soni 2013-06-07 00:02:26 +05:30
parent 5d896df6af
commit 36e81da58c
8 changed files with 236 additions and 236 deletions

View File

@ -35,8 +35,8 @@ DefineStaticJSVals(JSContext* cx)
int HandlerFamily;
js::ListBaseShadowsResult
DOMListShadows(JSContext* cx, JSHandleObject proxy, JSHandleId id)
js::DOMProxyShadowsResult
DOMProxyShadows(JSContext* cx, JSHandleObject proxy, JSHandleId id)
{
JS::Value v = js::GetProxyExtra(proxy, JSPROXYSLOT_EXPANDO);
if (v.isObject()) {
@ -59,15 +59,15 @@ DOMListShadows(JSContext* cx, JSHandleObject proxy, JSHandleId id)
}
// Store the information for the specialized ICs.
struct SetListBaseInformation
struct SetDOMProxyInformation
{
SetListBaseInformation() {
js::SetListBaseInformation((void*) &HandlerFamily,
js::JSSLOT_PROXY_EXTRA + JSPROXYSLOT_EXPANDO, DOMListShadows);
SetDOMProxyInformation() {
js::SetDOMProxyInformation((void*) &HandlerFamily,
js::JSSLOT_PROXY_EXTRA + JSPROXYSLOT_EXPANDO, DOMProxyShadow);
}
};
SetListBaseInformation gSetListBaseInformation;
SetDOMProxyInformation gSetDOMProxyInformation;
// static
JSObject*

View File

@ -302,13 +302,13 @@ ICStub::trace(JSTracer *trc)
MarkShape(trc, &propStub->holderShape(), "baseline-getpropnativeproto-stub-holdershape");
break;
}
case ICStub::GetProp_CallListBaseNative:
case ICStub::GetProp_CallListBaseWithGenerationNative: {
ICGetPropCallListBaseNativeStub *propStub;
if (kind() == ICStub::GetProp_CallListBaseNative)
propStub = toGetProp_CallListBaseNative();
case ICStub::GetProp_CallDOMProxyNative:
case ICStub::GetProp_CallDOMProxyWithGenerationNative: {
ICGetPropCallDOMProxyNativeStub *propStub;
if (kind() == ICStub::GetProp_CallDOMProxyNative)
propStub = toGetProp_CallDOMProxyNative();
else
propStub = toGetProp_CallListBaseWithGenerationNative();
propStub = toGetProp_CallDOMProxyWithGenerationNative();
MarkShape(trc, &propStub->shape(), "baseline-getproplistbasenative-stub-shape");
if (propStub->expandoShape()) {
MarkShape(trc, &propStub->expandoShape(),
@ -319,8 +319,8 @@ ICStub::trace(JSTracer *trc)
MarkObject(trc, &propStub->getter(), "baseline-getproplistbasenative-stub-getter");
break;
}
case ICStub::GetProp_ListBaseShadowed: {
ICGetProp_ListBaseShadowed *propStub = toGetProp_ListBaseShadowed();
case ICStub::GetProp_DOMProxyShadowed: {
ICGetProp_DOMProxyShadowed *propStub = toGetProp_DOMProxyShadowed();
MarkShape(trc, &propStub->shape(), "baseline-getproplistbaseshadowed-stub-shape");
MarkString(trc, &propStub->name(), "baseline-getproplistbaseshadowed-stub-name");
break;
@ -618,10 +618,10 @@ ICStubCompiler::guardProfilingEnabled(MacroAssembler &masm, Register scratch, La
// This should only be called from the following stubs.
JS_ASSERT(kind == ICStub::Call_Scripted || kind == ICStub::Call_AnyScripted ||
kind == ICStub::Call_Native || kind == ICStub::GetProp_CallScripted ||
kind == ICStub::GetProp_CallNative || kind == ICStub::GetProp_CallListBaseNative ||
kind == ICStub::GetProp_CallNative || kind == ICStub::GetProp_CallDOMProxyNative ||
kind == ICStub::Call_ScriptedApplyArguments ||
kind == ICStub::GetProp_CallListBaseWithGenerationNative ||
kind == ICStub::GetProp_ListBaseShadowed ||
kind == ICStub::GetProp_CallDOMProxyWithGenerationNative ||
kind == ICStub::GetProp_DOMProxyShadowed ||
kind == ICStub::SetProp_CallScripted || kind == ICStub::SetProp_CallNative);
// Guard on bit in frame that indicates if the SPS frame was pushed in the first
@ -3058,47 +3058,47 @@ static void GetFixedOrDynamicSlotOffset(HandleObject obj, uint32_t slot,
}
static bool
IsCacheableListBase(JSObject *obj)
IsCacheableDOMProxy(JSObject *obj)
{
if (!obj->isProxy())
return false;
BaseProxyHandler *handler = GetProxyHandler(obj);
if (handler->family() != GetListBaseHandlerFamily())
if (handler->family() != GetDOMProxyHandlerFamily())
return false;
if (obj->numFixedSlots() <= GetListBaseExpandoSlot())
if (obj->numFixedSlots() <= GetDOMProxyExpandoSlot())
return false;
return true;
}
static JSObject *
GetListBaseProto(JSObject *obj)
GetDOMProxyProto(JSObject *obj)
{
JS_ASSERT(IsCacheableListBase(obj));
JS_ASSERT(IsCacheableDOMProxy(obj));
return obj->getTaggedProto().toObjectOrNull();
}
static void
GenerateListBaseChecks(JSContext *cx, MacroAssembler &masm, Register object,
GenerateDOMProxyChecks(JSContext *cx, MacroAssembler &masm, Register object,
Address checkProxyHandlerAddr,
Address *checkExpandoShapeAddr,
Address *expandoAndGenerationAddr,
Address *generationAddr,
Register scratch,
GeneralRegisterSet &listBaseRegSet,
GeneralRegisterSet &domProxyRegSet,
Label *checkFailed)
{
// Guard the following:
// 1. The object is a ListBase.
// 1. The object is a DOMProxy.
// 2. The object does not have expando properties, or has an expando
// which is known to not have the desired property.
Address handlerAddr(object, JSObject::getFixedSlotOffset(JSSLOT_PROXY_HANDLER));
Address expandoAddr(object, JSObject::getFixedSlotOffset(GetListBaseExpandoSlot()));
Address expandoAddr(object, JSObject::getFixedSlotOffset(GetDOMProxyExpandoSlot()));
// Check that object is a ListBase.
// Check that object is a DOMProxy.
masm.loadPtr(checkProxyHandlerAddr, scratch);
masm.branchPrivatePtr(Assembler::NotEqual, handlerAddr, scratch, checkFailed);
@ -3108,23 +3108,23 @@ GenerateListBaseChecks(JSContext *cx, MacroAssembler &masm, Register object,
// For the remaining code, we need to reserve some registers to load a value.
// This is ugly, but unavoidable.
ValueOperand tempVal = listBaseRegSet.takeAnyValue();
ValueOperand tempVal = domProxyRegSet.takeAnyValue();
masm.pushValue(tempVal);
Label failListBaseCheck;
Label listBaseOk;
Label failDOMProxyCheck;
Label domProxyOk;
if (expandoAndGenerationAddr) {
JS_ASSERT(generationAddr);
masm.loadPtr(*expandoAndGenerationAddr, tempVal.scratchReg());
masm.branchPrivatePtr(Assembler::NotEqual, expandoAddr, tempVal.scratchReg(),
&failListBaseCheck);
&failDOMProxyCheck);
masm.load32(*generationAddr, scratch);
masm.branch32(Assembler::NotEqual,
Address(tempVal.scratchReg(), offsetof(ExpandoAndGeneration, expando)),
scratch, &failListBaseCheck);
scratch, &failDOMProxyCheck);
masm.loadValue(Address(tempVal.scratchReg(), 0), tempVal);
} else {
@ -3133,27 +3133,27 @@ GenerateListBaseChecks(JSContext *cx, MacroAssembler &masm, Register object,
// If the incoming object does not have an expando object then we're sure we're not
// shadowing.
masm.branchTestUndefined(Assembler::Equal, tempVal, &listBaseOk);
masm.branchTestUndefined(Assembler::Equal, tempVal, &domProxyOk);
// The reference object used to generate this check may not have had an
// expando object at all, in which case the presence of a non-undefined
// expando value in the incoming object is automatically a failure.
masm.loadPtr(*checkExpandoShapeAddr, scratch);
masm.branchPtr(Assembler::Equal, scratch, ImmWord((void*)NULL), &failListBaseCheck);
masm.branchPtr(Assembler::Equal, scratch, ImmWord((void*)NULL), &failDOMProxyCheck);
// Otherwise, ensure that the incoming object has an object for its expando value and that
// the shape matches.
masm.branchTestObject(Assembler::NotEqual, tempVal, &failListBaseCheck);
masm.branchTestObject(Assembler::NotEqual, tempVal, &failDOMProxyCheck);
Register objReg = masm.extractObject(tempVal, tempVal.scratchReg());
masm.branchTestObjShape(Assembler::Equal, objReg, scratch, &listBaseOk);
masm.branchTestObjShape(Assembler::Equal, objReg, scratch, &domProxyOk);
// Failure case: restore the tempVal registers and jump to failures.
masm.bind(&failListBaseCheck);
masm.bind(&failDOMProxyCheck);
masm.popValue(tempVal);
masm.jump(checkFailed);
// Success case: restore the tempval and proceed.
masm.bind(&listBaseOk);
masm.bind(&domProxyOk);
masm.popValue(tempVal);
}
@ -3163,29 +3163,29 @@ GenerateListBaseChecks(JSContext *cx, MacroAssembler &masm, Register object,
static bool
EffectlesslyLookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
MutableHandleObject holder, MutableHandleShape shape,
bool *checkListBase=NULL,
ListBaseShadowsResult *shadowsResult=NULL,
bool *listBaseHasGeneration=NULL)
bool *checkDOMProxy=NULL,
DOMProxyShadowsResult *shadowsResult=NULL,
bool *domProxyHasGeneration=NULL)
{
shape.set(NULL);
holder.set(NULL);
bool isListBase = false;
if (checkListBase)
*checkListBase = false;
bool isDOMProxy = false;
if (checkDOMProxy)
*checkDOMProxy = false;
// Check for list base if asked to.
RootedObject checkObj(cx, obj);
if (checkListBase && IsCacheableListBase(obj)) {
JS_ASSERT(listBaseHasGeneration);
if (checkDOMProxy && IsCacheableDOMProxy(obj)) {
JS_ASSERT(domProxyHasGeneration);
JS_ASSERT(shadowsResult);
*checkListBase = isListBase = true;
*checkDOMProxy = isDOMProxy = true;
if (obj->hasUncacheableProto())
return true;
RootedId id(cx, NameToId(name));
*shadowsResult = GetListBaseShadowsCheck()(cx, obj, id);
*shadowsResult = GetDOMProxyShadowsCheck()(cx, obj, id);
if (*shadowsResult == ShadowCheckFailed)
return false;
@ -3194,12 +3194,12 @@ EffectlesslyLookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName n
return true;
}
*listBaseHasGeneration = (*shadowsResult == DoesntShadowUnique);
*domProxyHasGeneration = (*shadowsResult == DoesntShadowUnique);
checkObj = GetListBaseProto(obj);
checkObj = GetDOMProxyProto(obj);
}
if (!isListBase && !obj->isNative())
if (!isDOMProxy && !obj->isNative())
return true;
if (checkObj->hasIdempotentProtoChain()) {
@ -3214,10 +3214,10 @@ EffectlesslyLookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName n
}
static bool
IsCacheableProtoChain(JSObject *obj, JSObject *holder, bool isListBase=false)
IsCacheableProtoChain(JSObject *obj, JSObject *holder, bool isDOMProxy=false)
{
JS_ASSERT_IF(isListBase, IsCacheableListBase(obj));
JS_ASSERT_IF(!isListBase, obj->isNative());
JS_ASSERT_IF(isDOMProxy, IsCacheableDOMProxy(obj));
JS_ASSERT_IF(!isDOMProxy, obj->isNative());
// Don't handle objects which require a prototype guard. This should
// be uncommon so handling it is likely not worth the complexity.
@ -3230,7 +3230,7 @@ IsCacheableProtoChain(JSObject *obj, JSObject *holder, bool isListBase=false)
// chain and must check for null proto. The prototype chain can be
// altered during the lookupProperty call.
JSObject *proto;
if (isListBase && cur == obj)
if (isDOMProxy && cur == obj)
proto = cur->getTaggedProto().toObjectOrNull();
else
proto = cur->getProto();
@ -3247,9 +3247,9 @@ IsCacheableProtoChain(JSObject *obj, JSObject *holder, bool isListBase=false)
}
static bool
IsCacheableGetPropReadSlot(JSObject *obj, JSObject *holder, Shape *shape, bool isListBase=false)
IsCacheableGetPropReadSlot(JSObject *obj, JSObject *holder, Shape *shape, bool isDOMProxy=false)
{
if (!shape || !IsCacheableProtoChain(obj, holder, isListBase))
if (!shape || !IsCacheableProtoChain(obj, holder, isDOMProxy))
return false;
if (!shape->hasSlot() || !shape->hasDefaultGetter())
@ -3260,7 +3260,7 @@ IsCacheableGetPropReadSlot(JSObject *obj, JSObject *holder, Shape *shape, bool i
static bool
IsCacheableGetPropCall(JSObject *obj, JSObject *holder, Shape *shape, bool *isScripted,
bool isListBase=false)
bool isDOMProxy=false)
{
JS_ASSERT(isScripted);
@ -3268,7 +3268,7 @@ IsCacheableGetPropCall(JSObject *obj, JSObject *holder, Shape *shape, bool *isSc
if (obj == holder)
return false;
if (!shape || !IsCacheableProtoChain(obj, holder, isListBase))
if (!shape || !IsCacheableProtoChain(obj, holder, isDOMProxy))
return false;
if (shape->hasSlot() || shape->hasDefaultGetter())
@ -5207,16 +5207,16 @@ TryAttachLengthStub(JSContext *cx, HandleScript script, ICGetProp_Fallback *stub
}
static bool
UpdateExistingGenerationalListBaseStub(ICGetProp_Fallback *stub,
UpdateExistingGenerationalDOMProxyStub(ICGetProp_Fallback *stub,
HandleObject obj)
{
Value expandoSlot = obj->getFixedSlot(GetListBaseExpandoSlot());
Value expandoSlot = obj->getFixedSlot(GetDOMProxyExpandoSlot());
JS_ASSERT(!expandoSlot.isObject() && !expandoSlot.isUndefined());
ExpandoAndGeneration *expandoAndGeneration = (ExpandoAndGeneration*)expandoSlot.toPrivate();
for (ICStubConstIterator iter = stub->beginChainConst(); !iter.atEnd(); iter++) {
if (iter->isGetProp_CallListBaseWithGenerationNative()) {
ICGetProp_CallListBaseWithGenerationNative* updateStub =
iter->toGetProp_CallListBaseWithGenerationNative();
if (iter->isGetProp_CallDOMProxyWithGenerationNative()) {
ICGetProp_CallDOMProxyWithGenerationNative* updateStub =
iter->toGetProp_CallDOMProxyWithGenerationNative();
if (updateStub->expandoAndGeneration() == expandoAndGeneration) {
// Update generation
uint32_t generation = expandoAndGeneration->generation;
@ -5244,22 +5244,22 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
RootedObject obj(cx, &val.toObject());
bool isListBase;
bool listBaseHasGeneration;
ListBaseShadowsResult listBaseShadowsResult;
bool isDOMProxy;
bool domProxyHasGeneration;
DOMProxyShadowsResult domProxyShadowsResult;
RootedShape shape(cx);
RootedObject holder(cx);
if (!EffectlesslyLookupProperty(cx, obj, name, &holder, &shape, &isListBase,
&listBaseShadowsResult, &listBaseHasGeneration))
if (!EffectlesslyLookupProperty(cx, obj, name, &holder, &shape, &isDOMProxy,
&domProxyShadowsResult, &domProxyHasGeneration))
{
return false;
}
if (!isListBase && !obj->isNative())
if (!isDOMProxy && !obj->isNative())
return true;
ICStub *monitorStub = stub->fallbackMonitorStub()->firstMonitorStub();
if (!isListBase && IsCacheableGetPropReadSlot(obj, holder, shape)) {
if (!isDOMProxy && IsCacheableGetPropReadSlot(obj, holder, shape)) {
bool isFixedSlot;
uint32_t offset;
GetFixedOrDynamicSlotOffset(holder, shape->slot(), &isFixedSlot, &offset);
@ -5268,7 +5268,7 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
: ICStub::GetProp_NativePrototype;
IonSpew(IonSpew_BaselineIC, " Generating GetProp(%s %s) stub",
isListBase ? "ListBase" : "Native",
isDOMProxy ? "DOMProxy" : "Native",
(obj == holder) ? "direct" : "prototype");
ICGetPropNativeCompiler compiler(cx, kind, monitorStub, obj, holder, isFixedSlot, offset);
ICStub *newStub = compiler.getStub(compiler.getStubSpace(script));
@ -5281,10 +5281,10 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
}
bool isScripted = false;
bool cacheableCall = IsCacheableGetPropCall(obj, holder, shape, &isScripted, isListBase);
bool cacheableCall = IsCacheableGetPropCall(obj, holder, shape, &isScripted, isDOMProxy);
// Try handling scripted getters.
if (cacheableCall && isScripted && !isListBase) {
if (cacheableCall && isScripted && !isDOMProxy) {
RootedFunction callee(cx, shape->getterObject()->toFunction());
JS_ASSERT(obj != holder);
JS_ASSERT(callee->hasScript());
@ -5310,23 +5310,23 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
JS_ASSERT(callee->isNative());
IonSpew(IonSpew_BaselineIC, " Generating GetProp(%s%s/NativeGetter %p) stub",
isListBase ? "ListBaseObj" : "NativeObj",
isListBase && listBaseHasGeneration ? "WithGeneration" : "",
isDOMProxy ? "DOMProxyObj" : "NativeObj",
isDOMProxy && domProxyHasGeneration ? "WithGeneration" : "",
callee->native());
ICStub *newStub = NULL;
if (isListBase) {
if (isDOMProxy) {
ICStub::Kind kind;
if (listBaseHasGeneration) {
if (UpdateExistingGenerationalListBaseStub(stub, obj)) {
if (domProxyHasGeneration) {
if (UpdateExistingGenerationalDOMProxyStub(stub, obj)) {
*attached = true;
return true;
}
kind = ICStub::GetProp_CallListBaseWithGenerationNative;
kind = ICStub::GetProp_CallDOMProxyWithGenerationNative;
} else {
kind = ICStub::GetProp_CallListBaseNative;
kind = ICStub::GetProp_CallDOMProxyNative;
}
ICGetPropCallListBaseNativeCompiler compiler(cx, kind, monitorStub, obj, holder, callee,
ICGetPropCallDOMProxyNativeCompiler compiler(cx, kind, monitorStub, obj, holder, callee,
pc - script->code);
newStub = compiler.getStub(compiler.getStubSpace(script));
} else {
@ -5342,11 +5342,11 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
}
// If it's a shadowed listbase proxy property, attach stub to call Proxy::get instead.
if (isListBase && listBaseShadowsResult == Shadows) {
if (isDOMProxy && domProxyShadowsResult == Shadows) {
JS_ASSERT(obj == holder);
IonSpew(IonSpew_BaselineIC, " Generating GetProp(ListBaseProxy) stub");
ICGetProp_ListBaseShadowed::Compiler compiler(cx, monitorStub, obj, name,
IonSpew(IonSpew_BaselineIC, " Generating GetProp(DOMProxyProxy) stub");
ICGetProp_DOMProxyShadowed::Compiler compiler(cx, monitorStub, obj, name,
pc - script->code);
ICStub *newStub = compiler.getStub(compiler.getStubSpace(script));
if (!newStub)
@ -5849,7 +5849,7 @@ ICGetProp_CallNative::Compiler::generateStubCode(MacroAssembler &masm)
}
bool
ICGetPropCallListBaseNativeCompiler::generateStubCode(MacroAssembler &masm,
ICGetPropCallDOMProxyNativeCompiler::generateStubCode(MacroAssembler &masm,
Address* expandoAndGenerationAddr,
Address* generationAddr)
{
@ -5864,29 +5864,29 @@ ICGetPropCallListBaseNativeCompiler::generateStubCode(MacroAssembler &masm,
Register objReg = masm.extractObject(R0, ExtractTemp0);
// Shape guard.
masm.loadPtr(Address(BaselineStubReg, ICGetProp_CallListBaseNative::offsetOfShape()), scratch);
masm.loadPtr(Address(BaselineStubReg, ICGetProp_CallDOMProxyNative::offsetOfShape()), scratch);
masm.branchTestObjShape(Assembler::NotEqual, objReg, scratch, &failure);
// Guard for ListObject.
{
GeneralRegisterSet listBaseRegSet(GeneralRegisterSet::All());
listBaseRegSet.take(BaselineStubReg);
listBaseRegSet.take(objReg);
listBaseRegSet.take(scratch);
Address expandoShapeAddr(BaselineStubReg, ICGetProp_CallListBaseNative::offsetOfExpandoShape());
GenerateListBaseChecks(
GeneralRegisterSet domProxyRegSet(GeneralRegisterSet::All());
domProxyRegSet.take(BaselineStubReg);
domProxyRegSet.take(objReg);
domProxyRegSet.take(scratch);
Address expandoShapeAddr(BaselineStubReg, ICGetProp_CallDOMProxyNative::offsetOfExpandoShape());
GenerateDOMProxyChecks(
cx, masm, objReg,
Address(BaselineStubReg, ICGetProp_CallListBaseNative::offsetOfProxyHandler()),
Address(BaselineStubReg, ICGetProp_CallDOMProxyNative::offsetOfProxyHandler()),
&expandoShapeAddr, expandoAndGenerationAddr, generationAddr,
scratch,
listBaseRegSet,
domProxyRegSet,
&failure);
}
Register holderReg = regs.takeAny();
masm.loadPtr(Address(BaselineStubReg, ICGetProp_CallListBaseNative::offsetOfHolder()),
masm.loadPtr(Address(BaselineStubReg, ICGetProp_CallDOMProxyNative::offsetOfHolder()),
holderReg);
masm.loadPtr(Address(BaselineStubReg, ICGetProp_CallListBaseNative::offsetOfHolderShape()),
masm.loadPtr(Address(BaselineStubReg, ICGetProp_CallDOMProxyNative::offsetOfHolderShape()),
scratch);
masm.branchTestObjShape(Assembler::NotEqual, holderReg, scratch, &failure);
regs.add(holderReg);
@ -5896,7 +5896,7 @@ ICGetPropCallListBaseNativeCompiler::generateStubCode(MacroAssembler &masm,
// Load callee function.
Register callee = regs.takeAny();
masm.loadPtr(Address(BaselineStubReg, ICGetProp_CallListBaseNative::offsetOfGetter()), callee);
masm.loadPtr(Address(BaselineStubReg, ICGetProp_CallDOMProxyNative::offsetOfGetter()), callee);
// Push args for vm call.
masm.push(objReg);
@ -5915,7 +5915,7 @@ ICGetPropCallListBaseNativeCompiler::generateStubCode(MacroAssembler &masm,
guardProfilingEnabled(masm, scratch, &skipProfilerUpdate);
// Update profiling entry before leaving function.
masm.load32(Address(BaselineStubReg, ICGetProp_CallListBaseNative::offsetOfPCOffset()),
masm.load32(Address(BaselineStubReg, ICGetProp_CallDOMProxyNative::offsetOfPCOffset()),
pcIdx);
masm.spsUpdatePCIdx(&cx->runtime->spsProfiler, pcIdx, scratch);
@ -5937,33 +5937,33 @@ ICGetPropCallListBaseNativeCompiler::generateStubCode(MacroAssembler &masm,
}
bool
ICGetPropCallListBaseNativeCompiler::generateStubCode(MacroAssembler &masm)
ICGetPropCallDOMProxyNativeCompiler::generateStubCode(MacroAssembler &masm)
{
if (kind == ICStub::GetProp_CallListBaseNative)
if (kind == ICStub::GetProp_CallDOMProxyNative)
return generateStubCode(masm, NULL, NULL);
Address internalStructAddress(BaselineStubReg,
ICGetProp_CallListBaseWithGenerationNative::offsetOfInternalStruct());
ICGetProp_CallDOMProxyWithGenerationNative::offsetOfInternalStruct());
Address generationAddress(BaselineStubReg,
ICGetProp_CallListBaseWithGenerationNative::offsetOfGeneration());
ICGetProp_CallDOMProxyWithGenerationNative::offsetOfGeneration());
return generateStubCode(masm, &internalStructAddress, &generationAddress);
}
ICStub *
ICGetPropCallListBaseNativeCompiler::getStub(ICStubSpace *space)
ICGetPropCallDOMProxyNativeCompiler::getStub(ICStubSpace *space)
{
RootedShape shape(cx, obj_->lastProperty());
RootedShape holderShape(cx, holder_->lastProperty());
Value expandoSlot = obj_->getFixedSlot(GetListBaseExpandoSlot());
Value expandoSlot = obj_->getFixedSlot(GetDOMProxyExpandoSlot());
RootedShape expandoShape(cx, NULL);
ExpandoAndGeneration *expandoAndGeneration;
int32_t generation;
Value expandoVal;
if (kind == ICStub::GetProp_CallListBaseNative) {
if (kind == ICStub::GetProp_CallDOMProxyNative) {
expandoVal = expandoSlot;
} else {
JS_ASSERT(kind == ICStub::GetProp_CallListBaseWithGenerationNative);
JS_ASSERT(kind == ICStub::GetProp_CallDOMProxyWithGenerationNative);
JS_ASSERT(!expandoSlot.isObject() && !expandoSlot.isUndefined());
expandoAndGeneration = (ExpandoAndGeneration*)expandoSlot.toPrivate();
expandoVal = expandoAndGeneration->expando;
@ -5973,23 +5973,23 @@ ICGetPropCallListBaseNativeCompiler::getStub(ICStubSpace *space)
if (expandoVal.isObject())
expandoShape = expandoVal.toObject().lastProperty();
if (kind == ICStub::GetProp_CallListBaseNative) {
return ICGetProp_CallListBaseNative::New(
if (kind == ICStub::GetProp_CallDOMProxyNative) {
return ICGetProp_CallDOMProxyNative::New(
space, getStubCode(), firstMonitorStub_, shape, GetProxyHandler(obj_),
expandoShape, holder_, holderShape, getter_, pcOffset_);
}
return ICGetProp_CallListBaseWithGenerationNative::New(
return ICGetProp_CallDOMProxyWithGenerationNative::New(
space, getStubCode(), firstMonitorStub_, shape, GetProxyHandler(obj_),
expandoAndGeneration, generation, expandoShape, holder_, holderShape, getter_,
pcOffset_);
}
ICStub *
ICGetProp_ListBaseShadowed::Compiler::getStub(ICStubSpace *space)
ICGetProp_DOMProxyShadowed::Compiler::getStub(ICStubSpace *space)
{
RootedShape shape(cx, obj_->lastProperty());
return ICGetProp_ListBaseShadowed::New(space, getStubCode(), firstMonitorStub_,
return ICGetProp_DOMProxyShadowed::New(space, getStubCode(), firstMonitorStub_,
shape, GetProxyHandler(obj_), name_, pcOffset_);
}
@ -6005,7 +6005,7 @@ typedef bool (*ProxyGetFn)(JSContext *cx, HandleObject proxy, HandlePropertyName
static const VMFunction ProxyGetInfo = FunctionInfo<ProxyGetFn>(ProxyGet);
bool
ICGetProp_ListBaseShadowed::Compiler::generateStubCode(MacroAssembler &masm)
ICGetProp_DOMProxyShadowed::Compiler::generateStubCode(MacroAssembler &masm)
{
Label failure;
@ -6022,21 +6022,21 @@ ICGetProp_ListBaseShadowed::Compiler::generateStubCode(MacroAssembler &masm)
Register objReg = masm.extractObject(R0, ExtractTemp0);
// Shape guard.
masm.loadPtr(Address(BaselineStubReg, ICGetProp_ListBaseShadowed::offsetOfShape()), scratch);
masm.loadPtr(Address(BaselineStubReg, ICGetProp_DOMProxyShadowed::offsetOfShape()), scratch);
masm.branchTestObjShape(Assembler::NotEqual, objReg, scratch, &failure);
// Guard for ListObject.
{
GeneralRegisterSet listBaseRegSet(GeneralRegisterSet::All());
listBaseRegSet.take(BaselineStubReg);
listBaseRegSet.take(objReg);
listBaseRegSet.take(scratch);
GenerateListBaseChecks(
GeneralRegisterSet domProxyRegSet(GeneralRegisterSet::All());
domProxyRegSet.take(BaselineStubReg);
domProxyRegSet.take(objReg);
domProxyRegSet.take(scratch);
GenerateDOMProxyChecks(
cx, masm, objReg,
Address(BaselineStubReg, ICGetProp_ListBaseShadowed::offsetOfProxyHandler()),
Address(BaselineStubReg, ICGetProp_DOMProxyShadowed::offsetOfProxyHandler()),
/*expandoShapeAddr=*/NULL, /*expandoAndGenerationAddr=*/NULL, /*generationAddr=*/NULL,
scratch,
listBaseRegSet,
domProxyRegSet,
&failure);
}
@ -6046,7 +6046,7 @@ ICGetProp_ListBaseShadowed::Compiler::generateStubCode(MacroAssembler &masm)
enterStubFrame(masm, scratch);
// Push property name and proxy object.
masm.loadPtr(Address(BaselineStubReg, ICGetProp_ListBaseShadowed::offsetOfName()), scratch);
masm.loadPtr(Address(BaselineStubReg, ICGetProp_DOMProxyShadowed::offsetOfName()), scratch);
masm.push(scratch);
masm.push(objReg);
@ -6063,7 +6063,7 @@ ICGetProp_ListBaseShadowed::Compiler::generateStubCode(MacroAssembler &masm)
guardProfilingEnabled(masm, scratch, &skipProfilerUpdate);
// Update profiling entry before leaving function.
masm.load32(Address(BaselineStubReg, ICGetProp_ListBaseShadowed::offsetOfPCOffset()), pcIdx);
masm.load32(Address(BaselineStubReg, ICGetProp_DOMProxyShadowed::offsetOfPCOffset()), pcIdx);
masm.spsUpdatePCIdx(&cx->runtime->spsProfiler, pcIdx, scratch);
masm.bind(&skipProfilerUpdate);
@ -8428,7 +8428,7 @@ ICCall_Native::ICCall_Native(IonCode *stubCode, ICStub *firstMonitorStub, Handle
pcOffset_(pcOffset)
{ }
ICGetPropCallListBaseNativeStub::ICGetPropCallListBaseNativeStub(Kind kind, IonCode *stubCode,
ICGetPropCallDOMProxyNativeStub::ICGetPropCallDOMProxyNativeStub(Kind kind, IonCode *stubCode,
ICStub *firstMonitorStub,
HandleShape shape,
BaseProxyHandler *proxyHandler,
@ -8447,7 +8447,7 @@ ICGetPropCallListBaseNativeStub::ICGetPropCallListBaseNativeStub(Kind kind, IonC
pcOffset_(pcOffset)
{ }
ICGetPropCallListBaseNativeCompiler::ICGetPropCallListBaseNativeCompiler(JSContext *cx,
ICGetPropCallDOMProxyNativeCompiler::ICGetPropCallDOMProxyNativeCompiler(JSContext *cx,
ICStub::Kind kind,
ICStub *firstMonitorStub,
HandleObject obj,
@ -8461,19 +8461,19 @@ ICGetPropCallListBaseNativeCompiler::ICGetPropCallListBaseNativeCompiler(JSConte
getter_(cx, getter),
pcOffset_(pcOffset)
{
JS_ASSERT(kind == ICStub::GetProp_CallListBaseNative ||
kind == ICStub::GetProp_CallListBaseWithGenerationNative);
JS_ASSERT(kind == ICStub::GetProp_CallDOMProxyNative ||
kind == ICStub::GetProp_CallDOMProxyWithGenerationNative);
JS_ASSERT(obj_->isProxy());
JS_ASSERT(GetProxyHandler(obj_)->family() == GetListBaseHandlerFamily());
JS_ASSERT(GetProxyHandler(obj_)->family() == GetDOMProxyHandlerFamily());
}
ICGetProp_ListBaseShadowed::ICGetProp_ListBaseShadowed(IonCode *stubCode,
ICGetProp_DOMProxyShadowed::ICGetProp_DOMProxyShadowed(IonCode *stubCode,
ICStub *firstMonitorStub,
HandleShape shape,
BaseProxyHandler *proxyHandler,
HandlePropertyName name,
uint32_t pcOffset)
: ICMonitoredStub(ICStub::GetProp_ListBaseShadowed, stubCode, firstMonitorStub),
: ICMonitoredStub(ICStub::GetProp_DOMProxyShadowed, stubCode, firstMonitorStub),
shape_(shape),
proxyHandler_(proxyHandler),
name_(name),

View File

@ -365,9 +365,9 @@ class ICEntry
_(GetProp_NativePrototype) \
_(GetProp_CallScripted) \
_(GetProp_CallNative) \
_(GetProp_CallListBaseNative)\
_(GetProp_CallListBaseWithGenerationNative)\
_(GetProp_ListBaseShadowed) \
_(GetProp_CallDOMProxyNative)\
_(GetProp_CallDOMProxyWithGenerationNative)\
_(GetProp_DOMProxyShadowed) \
_(GetProp_ArgumentsLength) \
\
_(SetProp_Fallback) \
@ -733,9 +733,9 @@ class ICStub
case UseCount_Fallback:
case GetProp_CallScripted:
case GetProp_CallNative:
case GetProp_CallListBaseNative:
case GetProp_CallListBaseWithGenerationNative:
case GetProp_ListBaseShadowed:
case GetProp_CallDOMProxyNative:
case GetProp_CallDOMProxyWithGenerationNative:
case GetProp_DOMProxyShadowed:
case SetProp_CallScripted:
case SetProp_CallNative:
return true;
@ -4192,11 +4192,11 @@ class ICGetProp_CallNative : public ICGetPropCallGetter
};
};
class ICGetPropCallListBaseNativeStub : public ICMonitoredStub
class ICGetPropCallDOMProxyNativeStub : public ICMonitoredStub
{
friend class ICStubSpace;
protected:
// Shape of the ListBase proxy
// Shape of the DOMProxy
HeapPtrShape shape_;
// Proxy handler to check against.
@ -4215,7 +4215,7 @@ class ICGetPropCallListBaseNativeStub : public ICMonitoredStub
// PC offset of call
uint32_t pcOffset_;
ICGetPropCallListBaseNativeStub(ICStub::Kind kind, IonCode *stubCode,
ICGetPropCallDOMProxyNativeStub(ICStub::Kind kind, IonCode *stubCode,
ICStub *firstMonitorStub, HandleShape shape,
BaseProxyHandler *proxyHandler, HandleShape expandoShape,
HandleObject holder, HandleShape holderShape,
@ -4242,42 +4242,42 @@ class ICGetPropCallListBaseNativeStub : public ICMonitoredStub
}
static size_t offsetOfShape() {
return offsetof(ICGetPropCallListBaseNativeStub, shape_);
return offsetof(ICGetPropCallDOMProxyNativeStub, shape_);
}
static size_t offsetOfProxyHandler() {
return offsetof(ICGetPropCallListBaseNativeStub, proxyHandler_);
return offsetof(ICGetPropCallDOMProxyNativeStub, proxyHandler_);
}
static size_t offsetOfExpandoShape() {
return offsetof(ICGetPropCallListBaseNativeStub, expandoShape_);
return offsetof(ICGetPropCallDOMProxyNativeStub, expandoShape_);
}
static size_t offsetOfHolder() {
return offsetof(ICGetPropCallListBaseNativeStub, holder_);
return offsetof(ICGetPropCallDOMProxyNativeStub, holder_);
}
static size_t offsetOfHolderShape() {
return offsetof(ICGetPropCallListBaseNativeStub, holderShape_);
return offsetof(ICGetPropCallDOMProxyNativeStub, holderShape_);
}
static size_t offsetOfGetter() {
return offsetof(ICGetPropCallListBaseNativeStub, getter_);
return offsetof(ICGetPropCallDOMProxyNativeStub, getter_);
}
static size_t offsetOfPCOffset() {
return offsetof(ICGetPropCallListBaseNativeStub, pcOffset_);
return offsetof(ICGetPropCallDOMProxyNativeStub, pcOffset_);
}
};
class ICGetProp_CallListBaseNative : public ICGetPropCallListBaseNativeStub
class ICGetProp_CallDOMProxyNative : public ICGetPropCallDOMProxyNativeStub
{
friend class ICStubSpace;
ICGetProp_CallListBaseNative(IonCode *stubCode, ICStub *firstMonitorStub, HandleShape shape,
ICGetProp_CallDOMProxyNative(IonCode *stubCode, ICStub *firstMonitorStub, HandleShape shape,
BaseProxyHandler *proxyHandler, HandleShape expandoShape,
HandleObject holder, HandleShape holderShape,
HandleFunction getter, uint32_t pcOffset)
: ICGetPropCallListBaseNativeStub(ICStub::GetProp_CallListBaseNative, stubCode,
: ICGetPropCallDOMProxyNativeStub(ICStub::GetProp_CallDOMProxyNative, stubCode,
firstMonitorStub, shape, proxyHandler, expandoShape,
holder, holderShape, getter, pcOffset)
{}
public:
static inline ICGetProp_CallListBaseNative *New(
static inline ICGetProp_CallDOMProxyNative *New(
ICStubSpace *space, IonCode *code, ICStub *firstMonitorStub,
HandleShape shape, BaseProxyHandler *proxyHandler,
HandleShape expandoShape, HandleObject holder, HandleShape holderShape,
@ -4285,26 +4285,26 @@ class ICGetProp_CallListBaseNative : public ICGetPropCallListBaseNativeStub
{
if (!code)
return NULL;
return space->allocate<ICGetProp_CallListBaseNative>(code, firstMonitorStub, shape,
return space->allocate<ICGetProp_CallDOMProxyNative>(code, firstMonitorStub, shape,
proxyHandler, expandoShape, holder,
holderShape, getter, pcOffset);
}
};
class ICGetProp_CallListBaseWithGenerationNative : public ICGetPropCallListBaseNativeStub
class ICGetProp_CallDOMProxyWithGenerationNative : public ICGetPropCallDOMProxyNativeStub
{
protected:
ExpandoAndGeneration *expandoAndGeneration_;
uint32_t generation_;
public:
ICGetProp_CallListBaseWithGenerationNative(IonCode *stubCode, ICStub *firstMonitorStub,
ICGetProp_CallDOMProxyWithGenerationNative(IonCode *stubCode, ICStub *firstMonitorStub,
HandleShape shape, BaseProxyHandler *proxyHandler,
ExpandoAndGeneration *expandoAndGeneration,
uint32_t generation, HandleShape expandoShape,
HandleObject holder, HandleShape holderShape,
HandleFunction getter, uint32_t pcOffset)
: ICGetPropCallListBaseNativeStub(ICStub::GetProp_CallListBaseWithGenerationNative,
: ICGetPropCallDOMProxyNativeStub(ICStub::GetProp_CallDOMProxyWithGenerationNative,
stubCode, firstMonitorStub, shape, proxyHandler,
expandoShape, holder, holderShape, getter, pcOffset),
expandoAndGeneration_(expandoAndGeneration),
@ -4312,7 +4312,7 @@ class ICGetProp_CallListBaseWithGenerationNative : public ICGetPropCallListBaseN
{
}
static inline ICGetProp_CallListBaseWithGenerationNative *New(
static inline ICGetProp_CallDOMProxyWithGenerationNative *New(
ICStubSpace *space, IonCode *code, ICStub *firstMonitorStub,
HandleShape shape, BaseProxyHandler *proxyHandler,
ExpandoAndGeneration *expandoAndGeneration, uint32_t generation,
@ -4321,7 +4321,7 @@ class ICGetProp_CallListBaseWithGenerationNative : public ICGetPropCallListBaseN
{
if (!code)
return NULL;
return space->allocate<ICGetProp_CallListBaseWithGenerationNative>(code, firstMonitorStub,
return space->allocate<ICGetProp_CallDOMProxyWithGenerationNative>(code, firstMonitorStub,
shape, proxyHandler, expandoAndGeneration,
generation, expandoShape, holder, holderShape,
getter, pcOffset);
@ -4339,14 +4339,14 @@ class ICGetProp_CallListBaseWithGenerationNative : public ICGetPropCallListBaseN
}
static size_t offsetOfInternalStruct() {
return offsetof(ICGetProp_CallListBaseWithGenerationNative, expandoAndGeneration_);
return offsetof(ICGetProp_CallDOMProxyWithGenerationNative, expandoAndGeneration_);
}
static size_t offsetOfGeneration() {
return offsetof(ICGetProp_CallListBaseWithGenerationNative, generation_);
return offsetof(ICGetProp_CallDOMProxyWithGenerationNative, generation_);
}
};
class ICGetPropCallListBaseNativeCompiler : public ICStubCompiler {
class ICGetPropCallDOMProxyNativeCompiler : public ICStubCompiler {
ICStub *firstMonitorStub_;
RootedObject obj_;
RootedObject holder_;
@ -4358,7 +4358,7 @@ class ICGetPropCallListBaseNativeCompiler : public ICStubCompiler {
bool generateStubCode(MacroAssembler &masm);
public:
ICGetPropCallListBaseNativeCompiler(JSContext *cx, ICStub::Kind kind,
ICGetPropCallDOMProxyNativeCompiler(JSContext *cx, ICStub::Kind kind,
ICStub *firstMonitorStub, HandleObject obj,
HandleObject holder, HandleFunction getter,
uint32_t pcOffset);
@ -4366,7 +4366,7 @@ class ICGetPropCallListBaseNativeCompiler : public ICStubCompiler {
ICStub *getStub(ICStubSpace *space);
};
class ICGetProp_ListBaseShadowed : public ICMonitoredStub
class ICGetProp_DOMProxyShadowed : public ICMonitoredStub
{
friend class ICStubSpace;
protected:
@ -4375,19 +4375,19 @@ class ICGetProp_ListBaseShadowed : public ICMonitoredStub
HeapPtrPropertyName name_;
uint32_t pcOffset_;
ICGetProp_ListBaseShadowed(IonCode *stubCode, ICStub *firstMonitorStub, HandleShape shape,
ICGetProp_DOMProxyShadowed(IonCode *stubCode, ICStub *firstMonitorStub, HandleShape shape,
BaseProxyHandler *proxyHandler, HandlePropertyName name,
uint32_t pcOffset);
public:
static inline ICGetProp_ListBaseShadowed *New(ICStubSpace *space, IonCode *code,
static inline ICGetProp_DOMProxyShadowed *New(ICStubSpace *space, IonCode *code,
ICStub *firstMonitorStub, HandleShape shape,
BaseProxyHandler *proxyHandler,
HandlePropertyName name, uint32_t pcOffset)
{
if (!code)
return NULL;
return space->allocate<ICGetProp_ListBaseShadowed>(code, firstMonitorStub, shape,
return space->allocate<ICGetProp_DOMProxyShadowed>(code, firstMonitorStub, shape,
proxyHandler, name, pcOffset);
}
@ -4399,16 +4399,16 @@ class ICGetProp_ListBaseShadowed : public ICMonitoredStub
}
static size_t offsetOfShape() {
return offsetof(ICGetProp_ListBaseShadowed, shape_);
return offsetof(ICGetProp_DOMProxyShadowed, shape_);
}
static size_t offsetOfProxyHandler() {
return offsetof(ICGetProp_ListBaseShadowed, proxyHandler_);
return offsetof(ICGetProp_DOMProxyShadowed, proxyHandler_);
}
static size_t offsetOfName() {
return offsetof(ICGetProp_ListBaseShadowed, name_);
return offsetof(ICGetProp_DOMProxyShadowed, name_);
}
static size_t offsetOfPCOffset() {
return offsetof(ICGetProp_ListBaseShadowed, pcOffset_);
return offsetof(ICGetProp_DOMProxyShadowed, pcOffset_);
}
class Compiler : public ICStubCompiler {

View File

@ -422,17 +422,17 @@ IonCache::initializeAddCacheState(LInstruction *ins, AddCacheState *addState)
}
static bool
IsCacheableListBase(JSObject *obj)
IsCacheableDOMProxy(JSObject *obj)
{
if (!obj->isProxy())
return false;
BaseProxyHandler *handler = GetProxyHandler(obj);
if (handler->family() != GetListBaseHandlerFamily())
if (handler->family() != GetDOMProxyHandlerFamily())
return false;
if (obj->numFixedSlots() <= GetListBaseExpandoSlot())
if (obj->numFixedSlots() <= GetDOMProxyExpandoSlot())
return false;
return true;
@ -452,7 +452,7 @@ GeneratePrototypeGuards(JSContext *cx, MacroAssembler &masm, JSObject *obj, JSOb
masm.branchPtr(Assembler::NotEqual, proto, ImmGCPtr(obj->getProto()), failures);
}
JSObject *pobj = IsCacheableListBase(obj)
JSObject *pobj = IsCacheableDOMProxy(obj)
? obj->getTaggedProto().toObjectOrNull()
: obj->getProto();
if (!pobj)
@ -477,7 +477,7 @@ IsCacheableProtoChain(JSObject *obj, JSObject *holder)
* chain and must check for null proto. The prototype chain can be
* altered during the lookupProperty call.
*/
JSObject *proto = IsCacheableListBase(obj)
JSObject *proto = IsCacheableDOMProxy(obj)
? obj->getTaggedProto().toObjectOrNull()
: obj->getProto();
if (!proto || !proto->isNative())
@ -514,7 +514,7 @@ IsCacheableNoProperty(JSObject *obj, JSObject *holder, Shape *shape, jsbytecode
return false;
// Don't generate missing property ICs if we skipped a non-native object, as
// lookups may extend beyond the prototype chain (e.g. for ListBase
// lookups may extend beyond the prototype chain (e.g. for DOMProxy
// proxies).
JSObject *obj2 = obj;
while (obj2) {
@ -625,20 +625,20 @@ EmitLoadSlot(MacroAssembler &masm, JSObject *holder, Shape *shape, Register hold
}
static void
GenerateListBaseChecks(JSContext *cx, MacroAssembler &masm, JSObject *obj,
GenerateDOMProxyChecks(JSContext *cx, MacroAssembler &masm, JSObject *obj,
PropertyName *name, Register object, Label *stubFailure,
bool skipExpandoCheck = false)
{
MOZ_ASSERT(IsCacheableListBase(obj));
MOZ_ASSERT(IsCacheableDOMProxy(obj));
// Guard the following:
// 1. The object is a ListBase.
// 1. The object is a DOMProxy.
// 2. The object does not have expando properties, or has an expando
// which is known to not have the desired property.
Address handlerAddr(object, JSObject::getFixedSlotOffset(JSSLOT_PROXY_HANDLER));
Address expandoSlotAddr(object, JSObject::getFixedSlotOffset(GetListBaseExpandoSlot()));
Address expandoSlotAddr(object, JSObject::getFixedSlotOffset(GetDOMProxyExpandoSlot()));
// Check that object is a ListBase.
// Check that object is a DOMProxy.
masm.branchPrivatePtr(Assembler::NotEqual, handlerAddr, ImmWord(GetProxyHandler(obj)), stubFailure);
if (skipExpandoCheck)
@ -646,26 +646,26 @@ GenerateListBaseChecks(JSContext *cx, MacroAssembler &masm, JSObject *obj,
// For the remaining code, we need to reserve some registers to load a value.
// This is ugly, but unvaoidable.
RegisterSet listBaseRegSet(RegisterSet::All());
listBaseRegSet.take(AnyRegister(object));
ValueOperand tempVal = listBaseRegSet.takeValueOperand();
RegisterSet domProxyRegSet(RegisterSet::All());
domProxyRegSet.take(AnyRegister(object));
ValueOperand tempVal = domProxyRegSet.takeValueOperand();
masm.pushValue(tempVal);
Label failListBaseCheck;
Label listBaseOk;
Label failDOMProxyCheck;
Label domProxyOk;
Value expandoVal = obj->getFixedSlot(GetListBaseExpandoSlot());
Value expandoVal = obj->getFixedSlot(GetDOMProxyExpandoSlot());
masm.loadValue(expandoSlotAddr, tempVal);
if (!expandoVal.isObject() && !expandoVal.isUndefined()) {
masm.branchTestValue(Assembler::NotEqual, tempVal, expandoVal, &failListBaseCheck);
masm.branchTestValue(Assembler::NotEqual, tempVal, expandoVal, &failDOMProxyCheck);
ExpandoAndGeneration *expandoAndGeneration = (ExpandoAndGeneration*)expandoVal.toPrivate();
masm.movePtr(ImmWord(expandoAndGeneration), tempVal.scratchReg());
masm.branch32(Assembler::NotEqual, Address(tempVal.scratchReg(), sizeof(Value)),
Imm32(expandoAndGeneration->generation),
&failListBaseCheck);
&failDOMProxyCheck);
expandoVal = expandoAndGeneration->expando;
masm.loadValue(Address(tempVal.scratchReg(), 0), tempVal);
@ -673,28 +673,28 @@ GenerateListBaseChecks(JSContext *cx, MacroAssembler &masm, JSObject *obj,
// If the incoming object does not have an expando object then we're sure we're not
// shadowing.
masm.branchTestUndefined(Assembler::Equal, tempVal, &listBaseOk);
masm.branchTestUndefined(Assembler::Equal, tempVal, &domProxyOk);
if (expandoVal.isObject()) {
JS_ASSERT(!expandoVal.toObject().nativeContains(cx, name));
// Reference object has an expando object that doesn't define the name. Check that
// the incoming object has an expando object with the same shape.
masm.branchTestObject(Assembler::NotEqual, tempVal, &failListBaseCheck);
masm.branchTestObject(Assembler::NotEqual, tempVal, &failDOMProxyCheck);
masm.extractObject(tempVal, tempVal.scratchReg());
masm.branchPtr(Assembler::Equal,
Address(tempVal.scratchReg(), JSObject::offsetOfShape()),
ImmGCPtr(expandoVal.toObject().lastProperty()),
&listBaseOk);
&domProxyOk);
}
// Failure case: restore the tempVal registers and jump to failures.
masm.bind(&failListBaseCheck);
masm.bind(&failDOMProxyCheck);
masm.popValue(tempVal);
masm.jump(stubFailure);
// Success case: restore the tempval and proceed.
masm.bind(&listBaseOk);
masm.bind(&domProxyOk);
masm.popValue(tempVal);
}
@ -720,11 +720,11 @@ GenerateReadSlot(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &at
ImmGCPtr(obj->lastProperty()),
failures);
bool isCacheableListBase = IsCacheableListBase(obj);
Label listBaseFailures;
if (isCacheableListBase) {
bool isCacheableDOMProxy = IsCacheableDOMProxy(obj);
Label domProxyFailures;
if (isCacheableDOMProxy) {
JS_ASSERT(multipleFailureJumps);
GenerateListBaseChecks(cx, masm, obj, name, object, &listBaseFailures);
GenerateDOMProxyChecks(cx, masm, obj, name, object, &domProxyFailures);
}
// If we need a scratch register, use either an output register or the
@ -815,8 +815,8 @@ GenerateReadSlot(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &at
masm.bind(&prototypeFailures);
if (restoreScratch)
masm.pop(scratchReg);
if (isCacheableListBase)
masm.bind(&listBaseFailures);
if (isCacheableDOMProxy)
masm.bind(&domProxyFailures);
masm.bind(failures);
}
@ -837,8 +837,8 @@ GenerateCallGetter(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &
masm.branchPtr(Assembler::NotEqual, Address(object, JSObject::offsetOfShape()),
ImmGCPtr(obj->lastProperty()), &stubFailure);
if (IsCacheableListBase(obj))
GenerateListBaseChecks(cx, masm, obj, name, object, &stubFailure);
if (IsCacheableDOMProxy(obj))
GenerateDOMProxyChecks(cx, masm, obj, name, object, &stubFailure);
JS_ASSERT(output.hasValue());
Register scratchReg = output.valueReg().scratchReg();
@ -1021,11 +1021,11 @@ GetPropertyIC::attachReadSlot(JSContext *cx, IonScript *ion, JSObject *obj, JSOb
}
bool
GetPropertyIC::attachListBaseShadowed(JSContext *cx, IonScript *ion, JSObject *obj,
GetPropertyIC::attachDOMProxyShadowed(JSContext *cx, IonScript *ion, JSObject *obj,
void *returnAddr)
{
JS_ASSERT(!idempotent());
JS_ASSERT(IsCacheableListBase(obj));
JS_ASSERT(IsCacheableDOMProxy(obj));
JS_ASSERT(output().hasValue());
Label failures;
@ -1040,8 +1040,8 @@ GetPropertyIC::attachListBaseShadowed(JSContext *cx, IonScript *ion, JSObject *o
ImmGCPtr(obj->lastProperty()),
&failures);
// Make sure object is a ListBase proxy
GenerateListBaseChecks(cx, masm, obj, name(), object(), &failures,
// Make sure object is a DOMProxy proxy
GenerateDOMProxyChecks(cx, masm, obj, name(), object(), &failures,
/*skipExpandoCheck=*/true);
// saveLive()
@ -1379,16 +1379,16 @@ TryAttachNativeGetPropStub(JSContext *cx, IonScript *ion,
JS_ASSERT(cache.canAttachStub());
RootedObject checkObj(cx, obj);
if (IsCacheableListBase(obj)) {
if (IsCacheableDOMProxy(obj)) {
RootedId id(cx, NameToId(name));
ListBaseShadowsResult shadows = GetListBaseShadowsCheck()(cx, obj, id);
DOMProxyShadowsResult shadows = GetDOMProxyShadowsCheck()(cx, obj, id);
if (shadows == ShadowCheckFailed)
return false;
if (shadows == Shadows) {
if (cache.idempotent() || !cache.output().hasValue())
return true;
*isCacheable = true;
return cache.attachListBaseShadowed(cx, ion, obj, returnAddr);
return cache.attachDOMProxyShadowed(cx, ion, obj, returnAddr);
}
if (shadows == DoesntShadowUnique)
// We reset the cache to clear out an existing IC for this object

View File

@ -545,7 +545,7 @@ class GetPropertyIC : public RepatchIonCache
bool attachReadSlot(JSContext *cx, IonScript *ion, JSObject *obj, JSObject *holder,
HandleShape shape);
bool attachListBaseShadowed(JSContext *cx, IonScript *ion, JSObject *obj, void *returnAddr);
bool attachDOMProxyShadowed(JSContext *cx, IonScript *ion, JSObject *obj, void *returnAddr);
bool attachCallGetter(JSContext *cx, IonScript *ion, JSObject *obj, JSObject *holder,
HandleShape shape,
const SafepointIndex *safepointIndex, void *returnAddr);

View File

@ -1008,35 +1008,35 @@ js::GetDOMCallbacks(JSRuntime *rt)
return rt->DOMcallbacks;
}
static void *gListBaseHandlerFamily = NULL;
static uint32_t gListBaseExpandoSlot = 0;
static ListBaseShadowsCheck gListBaseShadowsCheck;
static void *gDOMProxyHandlerFamily = NULL;
static uint32_t gDOMProxyExpandoSlot = 0;
static DOMProxyShadowsCheck gDOMProxyShadowsCheck;
JS_FRIEND_API(void)
js::SetListBaseInformation(void *listBaseHandlerFamily, uint32_t listBaseExpandoSlot,
ListBaseShadowsCheck listBaseShadowsCheck)
js::SetDOMProxyInformation(void *domProxyHandlerFamily, uint32_t domProxyExpandoSlot,
DOMProxyShadowsCheck domProxyShadowsCheck)
{
gListBaseHandlerFamily = listBaseHandlerFamily;
gListBaseExpandoSlot = listBaseExpandoSlot;
gListBaseShadowsCheck = listBaseShadowsCheck;
gDOMProxyHandlerFamily = domProxyHandlerFamily;
gDOMProxyExpandoSlot = domProxyExpandoSlot;
gDOMProxyShadowsCheck = domProxyShadowsCheck;
}
void *
js::GetListBaseHandlerFamily()
js::GetDOMProxyHandlerFamily()
{
return gListBaseHandlerFamily;
return gDOMProxyHandlerFamily;
}
uint32_t
js::GetListBaseExpandoSlot()
js::GetDOMProxyExpandoSlot()
{
return gListBaseExpandoSlot;
return gDOMProxyExpandoSlot;
}
ListBaseShadowsCheck
js::GetListBaseShadowsCheck()
DOMProxyShadowsCheck
js::GetDOMProxyShadowsCheck()
{
return gListBaseShadowsCheck;
return gDOMProxyShadowsCheck;
}
JS_FRIEND_API(void)

View File

@ -859,10 +859,10 @@ NukeCrossCompartmentWrappers(JSContext* cx,
const CompartmentFilter& targetFilter,
NukeReferencesToWindow nukeReferencesToWindow);
/* Specify information about ListBase proxies in the DOM, for use by ICs. */
/* Specify information about DOMProxy proxies in the DOM, for use by ICs. */
/*
* The ListBaseShadowsCheck function will be called to check if the property for
* The DOMProxyShadowsCheck function will be called to check if the property for
* id should be gotten from the prototype, or if there is an own property that
* shadows it.
* If DoesntShadow is returned then the slot at listBaseExpandoSlot should
@ -885,21 +885,21 @@ struct ExpandoAndGeneration {
uint32_t generation;
};
typedef enum ListBaseShadowsResult {
typedef enum DOMProxyShadowsResult {
ShadowCheckFailed,
Shadows,
DoesntShadow,
DoesntShadowUnique
} ListBaseShadowsResult;
typedef ListBaseShadowsResult
(* ListBaseShadowsCheck)(JSContext* cx, JSHandleObject object, JSHandleId id);
} DOMProxyShadowsResult;
typedef DOMProxyShadowsResult
(* DOMProxyShadowsCheck)(JSContext* cx, JSHandleObject object, JSHandleId id);
JS_FRIEND_API(void)
SetListBaseInformation(void *listBaseHandlerFamily, uint32_t listBaseExpandoSlot,
ListBaseShadowsCheck listBaseShadowsCheck);
SetDOMProxyInformation(void *domProxyHandlerFamily, uint32_t domProxyExpandoSlot,
DOMProxyShadowsCheck domProxyShadowsCheck);
void *GetListBaseHandlerFamily();
uint32_t GetListBaseExpandoSlot();
ListBaseShadowsCheck GetListBaseShadowsCheck();
void *GetDOMProxyHandlerFamily();
uint32_t GetDOMProxyExpandoSlot();
DOMProxyShadowsCheck GetDOMProxyShadowsCheck();
} /* namespace js */

View File

@ -265,7 +265,7 @@ TryPreserveReflector(JSContext *cx, HandleObject obj)
{
if (obj->getClass()->ext.isWrappedNative ||
(obj->getClass()->flags & JSCLASS_IS_DOMJSCLASS) ||
(obj->isProxy() && GetProxyHandler(obj)->family() == GetListBaseHandlerFamily()))
(obj->isProxy() && GetProxyHandler(obj)->family() == GetDOMProxyHandlerFamily()))
{
JS_ASSERT(cx->runtime->preserveWrapperCallback);
if (!cx->runtime->preserveWrapperCallback(cx, obj)) {