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
fbb39a912b
commit
deb7ce6621
@ -1486,6 +1486,8 @@ SetPropertyIC::update(JSContext *cx, size_t cacheIndex, HandleObject obj,
|
||||
return true;
|
||||
}
|
||||
|
||||
const size_t GetElementIC::MAX_FAILED_UPDATES = 16;
|
||||
|
||||
bool
|
||||
GetElementIC::attachGetProp(JSContext *cx, IonScript *ion, HandleObject obj,
|
||||
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))
|
||||
return false;
|
||||
|
||||
// If no new attach was done, and we've reached maximum number of stubs, then
|
||||
// disable the cache.
|
||||
if (!attachedStub && !cache.canAttachStub())
|
||||
cache.disable();
|
||||
// Disable cache when we reach max stubs or update failed too much.
|
||||
if (!attachedStub) {
|
||||
cache.incFailedUpdates();
|
||||
if (cache.shouldDisable()) {
|
||||
IonSpew(IonSpew_InlineCaches, "Disable inline cache");
|
||||
cache.disable();
|
||||
}
|
||||
} else {
|
||||
cache.resetFailedUpdates();
|
||||
}
|
||||
|
||||
types::TypeScript::Monitor(cx, script, pc, res);
|
||||
return true;
|
||||
|
@ -411,9 +411,14 @@ class GetElementIC : public IonCache
|
||||
Register object_;
|
||||
ConstantOrRegister index_;
|
||||
TypedOrValueRegister output_;
|
||||
|
||||
bool monitoredResult_ : 1;
|
||||
bool hasDenseStub_ : 1;
|
||||
|
||||
size_t failedUpdates_;
|
||||
|
||||
static const size_t MAX_FAILED_UPDATES;
|
||||
|
||||
public:
|
||||
GetElementIC(Register object, ConstantOrRegister index,
|
||||
TypedOrValueRegister output, bool monitoredResult)
|
||||
@ -421,7 +426,8 @@ class GetElementIC : public IonCache
|
||||
index_(index),
|
||||
output_(output),
|
||||
monitoredResult_(monitoredResult),
|
||||
hasDenseStub_(false)
|
||||
hasDenseStub_(false),
|
||||
failedUpdates_(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -454,6 +460,17 @@ class GetElementIC : public IonCache
|
||||
static bool
|
||||
update(JSContext *cx, size_t cacheIndex, HandleObject obj, HandleValue idval,
|
||||
MutableHandleValue vp);
|
||||
|
||||
void incFailedUpdates() {
|
||||
failedUpdates_++;
|
||||
}
|
||||
void resetFailedUpdates() {
|
||||
failedUpdates_ = 0;
|
||||
}
|
||||
bool shouldDisable() const {
|
||||
return !canAttachStub() ||
|
||||
(stubCount_ == 0 && failedUpdates_ > MAX_FAILED_UPDATES);
|
||||
}
|
||||
};
|
||||
|
||||
class BindNameIC : public IonCache
|
||||
|
Loading…
Reference in New Issue
Block a user