Bug 1128535 followup - Fix Dromaeo DOM Query regression. r=efaust

This commit is contained in:
Jan de Mooij 2015-02-05 12:01:07 +01:00
parent f30329f60c
commit 779d99170b
3 changed files with 36 additions and 13 deletions

View File

@ -5770,9 +5770,10 @@ UpdateExistingSetPropCallStubs(ICSetProp_Fallback* fallbackStub,
static bool
TryAttachGlobalNameStub(JSContext *cx, HandleScript script, jsbytecode *pc,
ICGetName_Fallback *stub, Handle<GlobalObject*> global,
HandlePropertyName name)
HandlePropertyName name, bool *attached, bool *isTemporarilyUnoptimizable)
{
MOZ_ASSERT(global->is<GlobalObject>());
MOZ_ASSERT(!*attached);
RootedId id(cx, NameToId(name));
@ -5823,6 +5824,7 @@ TryAttachGlobalNameStub(JSContext *cx, HandleScript script, jsbytecode *pc,
return false;
stub->addNewStub(newStub);
*attached = true;
return true;
}
@ -5830,8 +5832,7 @@ TryAttachGlobalNameStub(JSContext *cx, HandleScript script, jsbytecode *pc,
// changes we need to make sure IonBuilder::getPropTryCommonGetter (which
// requires a Baseline stub) handles non-outerized this objects correctly.
bool isScripted;
bool isTemporarilyUnoptimizable = false;
if (IsCacheableGetPropCall(cx, global, current, shape, &isScripted, &isTemporarilyUnoptimizable) &&
if (IsCacheableGetPropCall(cx, global, current, shape, &isScripted, isTemporarilyUnoptimizable) &&
!isScripted)
{
ICStub *monitorStub = stub->fallbackMonitorStub()->firstMonitorStub();
@ -5865,6 +5866,7 @@ TryAttachGlobalNameStub(JSContext *cx, HandleScript script, jsbytecode *pc,
return false;
stub->addNewStub(newStub);
*attached = true;
return true;
}
@ -5873,8 +5875,10 @@ TryAttachGlobalNameStub(JSContext *cx, HandleScript script, jsbytecode *pc,
static bool
TryAttachScopeNameStub(JSContext *cx, HandleScript script, ICGetName_Fallback *stub,
HandleObject initialScopeChain, HandlePropertyName name)
HandleObject initialScopeChain, HandlePropertyName name, bool *attached)
{
MOZ_ASSERT(!*attached);
AutoShapeVector shapes(cx);
RootedId id(cx, NameToId(name));
RootedObject scopeChain(cx, initialScopeChain);
@ -5963,6 +5967,7 @@ TryAttachScopeNameStub(JSContext *cx, HandleScript script, ICGetName_Fallback *s
return false;
stub->addNewStub(newStub);
*attached = true;
return true;
}
@ -6006,17 +6011,22 @@ DoGetNameFallback(JSContext *cx, BaselineFrame *frame, ICGetName_Fallback *stub_
return true;
}
bool attached = false;
bool isTemporarilyUnoptimizable = false;
if (js_CodeSpec[*pc].format & JOF_GNAME) {
if (!TryAttachGlobalNameStub(cx, script, pc, stub, scopeChain.as<GlobalObject>(), name))
Handle<GlobalObject*> global = scopeChain.as<GlobalObject>();
if (!TryAttachGlobalNameStub(cx, script, pc, stub, global, name, &attached,
&isTemporarilyUnoptimizable))
{
return false;
}
} else {
if (!TryAttachScopeNameStub(cx, script, stub, scopeChain, name))
if (!TryAttachScopeNameStub(cx, script, stub, scopeChain, name, &attached))
return false;
}
// If we ever add a way to note unoptimizable accesses here, propagate the
// isTemporarilyUnoptimizable state from TryAttachGlobalNameStub to here.
if (!attached && !isTemporarilyUnoptimizable)
stub->noteUnoptimizableAccess();
return true;
}

View File

@ -3788,6 +3788,15 @@ class ICGetName_Fallback : public ICMonitoredFallbackStub
return space->allocate<ICGetName_Fallback>(code);
}
static const size_t UNOPTIMIZABLE_ACCESS_BIT = 0;
void noteUnoptimizableAccess() {
extra_ |= (1u << UNOPTIMIZABLE_ACCESS_BIT);
}
bool hadUnoptimizableAccess() const {
return extra_ & (1u << UNOPTIMIZABLE_ACCESS_BIT);
}
class Compiler : public ICStubCompiler {
protected:
bool generateStubCode(MacroAssembler &masm);

View File

@ -598,10 +598,14 @@ BaselineInspector::commonGetPropFunction(jsbytecode *pc, JSObject **holder, Shap
} else {
MOZ_ASSERT(*commonGetter == nstub->getter());
}
} else if (!stub->isGetProp_Fallback() ||
stub->toGetProp_Fallback()->hadUnoptimizableAccess())
{
// We have an unoptimizable access, so don't try to optimize.
} else if (stub->isGetProp_Fallback()) {
// If we have an unoptimizable access, don't try to optimize.
if (stub->toGetProp_Fallback()->hadUnoptimizableAccess())
return false;
} else if (stub->isGetName_Fallback()) {
if (stub->toGetName_Fallback()->hadUnoptimizableAccess())
return false;
} else {
return false;
}
}