зеркало из https://github.com/mozilla/gecko-dev.git
Bug 815161: Use caching getproperty to fetch prototype to create this, r=jandem
This commit is contained in:
Родитель
21cb5d7c5e
Коммит
492b9c2d6f
|
@ -3517,15 +3517,29 @@ MDefinition *
|
|||
IonBuilder::createThisScripted(MDefinition *callee)
|
||||
{
|
||||
// Get callee.prototype.
|
||||
//
|
||||
// This instruction MUST be idempotent: since it does not correspond to an
|
||||
// explicit operation in the bytecode, we cannot use resumeAfter(). But
|
||||
// calling GetProperty can trigger a GC, and thus invalidation.
|
||||
MCallGetProperty *getProto = MCallGetProperty::New(callee, cx->names().classPrototype);
|
||||
|
||||
// Getters may not override |prototype| fetching, so this is repeatable.
|
||||
getProto->markUneffectful();
|
||||
// explicit operation in the bytecode, we cannot use resumeAfter().
|
||||
// Getters may not override |prototype| fetching, so this operation is indeed idempotent.
|
||||
// - First try an idempotent property cache.
|
||||
// - Upon failing idempotent property cache, we can't use a non-idempotent cache,
|
||||
// therefore we fallback to CallGetProperty
|
||||
//
|
||||
// Note: both CallGetProperty and GetPropertyCache can trigger a GC,
|
||||
// and thus invalidation.
|
||||
MInstruction *getProto;
|
||||
if (!invalidatedIdempotentCache()) {
|
||||
MGetPropertyCache *getPropCache = MGetPropertyCache::New(callee, cx->names().classPrototype);
|
||||
getPropCache->setIdempotent();
|
||||
getProto = getPropCache;
|
||||
} else {
|
||||
MCallGetProperty *callGetProp = MCallGetProperty::New(callee, cx->names().classPrototype);
|
||||
callGetProp->setIdempotent();
|
||||
getProto = callGetProp;
|
||||
}
|
||||
current->add(getProto);
|
||||
|
||||
// Create this from prototype
|
||||
MCreateThis *createThis = MCreateThis::New(callee, getProto, NULL);
|
||||
current->add(createThis);
|
||||
|
||||
|
|
|
@ -4823,11 +4823,11 @@ class MCallGetProperty
|
|||
public BoxInputsPolicy
|
||||
{
|
||||
CompilerRootPropertyName name_;
|
||||
bool markEffectful_;
|
||||
bool idempotent_;
|
||||
|
||||
MCallGetProperty(MDefinition *value, HandlePropertyName name)
|
||||
: MUnaryInstruction(value), name_(name),
|
||||
markEffectful_(true)
|
||||
idempotent_(false)
|
||||
{
|
||||
setResultType(MIRType_Value);
|
||||
}
|
||||
|
@ -4851,11 +4851,11 @@ class MCallGetProperty
|
|||
// Constructors need to perform a GetProp on the function prototype.
|
||||
// Since getters cannot be set on the prototype, fetching is non-effectful.
|
||||
// The operation may be safely repeated in case of bailout.
|
||||
void markUneffectful() {
|
||||
markEffectful_ = false;
|
||||
void setIdempotent() {
|
||||
idempotent_ = true;
|
||||
}
|
||||
AliasSet getAliasSet() const {
|
||||
if (markEffectful_)
|
||||
if (!idempotent_)
|
||||
return AliasSet::Store(AliasSet::Any);
|
||||
return AliasSet::None();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче