mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 851552: IonMonkey: Disable GetElement caches after failing multiple times to attach stubs, r=djvj
This commit is contained in:
parent
bac96cf5c1
commit
b1ef7704f5
@ -1486,6 +1486,8 @@ SetPropertyIC::update(JSContext *cx, size_t cacheIndex, HandleObject obj,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const size_t GetElementIC::MAX_FAILED_UPDATES = 16;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
GetElementIC::attachGetProp(JSContext *cx, IonScript *ion, HandleObject obj,
|
GetElementIC::attachGetProp(JSContext *cx, IonScript *ion, HandleObject obj,
|
||||||
const Value &idval, HandlePropertyName name)
|
const Value &idval, HandlePropertyName name)
|
||||||
@ -1725,10 +1727,16 @@ GetElementIC::update(JSContext *cx, size_t cacheIndex, HandleObject obj,
|
|||||||
if (!GetElementOperation(cx, JSOp(*pc), &lval, idval, res))
|
if (!GetElementOperation(cx, JSOp(*pc), &lval, idval, res))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If no new attach was done, and we've reached maximum number of stubs, then
|
// Disable cache when we reach max stubs or update failed too much.
|
||||||
// disable the cache.
|
if (!attachedStub) {
|
||||||
if (!attachedStub && !cache.canAttachStub())
|
cache.incFailedUpdates();
|
||||||
cache.disable();
|
if (cache.shouldDisable()) {
|
||||||
|
IonSpew(IonSpew_InlineCaches, "Disable inline cache");
|
||||||
|
cache.disable();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cache.resetFailedUpdates();
|
||||||
|
}
|
||||||
|
|
||||||
types::TypeScript::Monitor(cx, script, pc, res);
|
types::TypeScript::Monitor(cx, script, pc, res);
|
||||||
return true;
|
return true;
|
||||||
|
@ -411,9 +411,14 @@ class GetElementIC : public IonCache
|
|||||||
Register object_;
|
Register object_;
|
||||||
ConstantOrRegister index_;
|
ConstantOrRegister index_;
|
||||||
TypedOrValueRegister output_;
|
TypedOrValueRegister output_;
|
||||||
|
|
||||||
bool monitoredResult_ : 1;
|
bool monitoredResult_ : 1;
|
||||||
bool hasDenseStub_ : 1;
|
bool hasDenseStub_ : 1;
|
||||||
|
|
||||||
|
size_t failedUpdates_;
|
||||||
|
|
||||||
|
static const size_t MAX_FAILED_UPDATES;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GetElementIC(Register object, ConstantOrRegister index,
|
GetElementIC(Register object, ConstantOrRegister index,
|
||||||
TypedOrValueRegister output, bool monitoredResult)
|
TypedOrValueRegister output, bool monitoredResult)
|
||||||
@ -421,7 +426,8 @@ class GetElementIC : public IonCache
|
|||||||
index_(index),
|
index_(index),
|
||||||
output_(output),
|
output_(output),
|
||||||
monitoredResult_(monitoredResult),
|
monitoredResult_(monitoredResult),
|
||||||
hasDenseStub_(false)
|
hasDenseStub_(false),
|
||||||
|
failedUpdates_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,6 +460,17 @@ class GetElementIC : public IonCache
|
|||||||
static bool
|
static bool
|
||||||
update(JSContext *cx, size_t cacheIndex, HandleObject obj, HandleValue idval,
|
update(JSContext *cx, size_t cacheIndex, HandleObject obj, HandleValue idval,
|
||||||
MutableHandleValue vp);
|
MutableHandleValue vp);
|
||||||
|
|
||||||
|
void incFailedUpdates() {
|
||||||
|
failedUpdates_++;
|
||||||
|
}
|
||||||
|
void resetFailedUpdates() {
|
||||||
|
failedUpdates_ = 0;
|
||||||
|
}
|
||||||
|
bool shouldDisable() const {
|
||||||
|
return !canAttachStub() ||
|
||||||
|
(stubCount_ == 0 && failedUpdates_ > MAX_FAILED_UPDATES);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BindNameIC : public IonCache
|
class BindNameIC : public IonCache
|
||||||
|
Loading…
Reference in New Issue
Block a user