зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1233818 part 8 - Don't patch loop backedges if it's not necessary. r=luke
This commit is contained in:
Родитель
6428bbee66
Коммит
0fbad405e3
|
@ -181,6 +181,7 @@ JitRuntime::JitRuntime(JSRuntime* rt)
|
|||
functionWrappers_(nullptr),
|
||||
osrTempData_(nullptr),
|
||||
preventBackedgePatching_(false),
|
||||
backedgeTarget_(BackedgeLoopHeader),
|
||||
ionReturnOverride_(MagicValue(JS_ARG_POISON)),
|
||||
jitcodeGlobalTable_(nullptr)
|
||||
{
|
||||
|
@ -371,6 +372,12 @@ JitRuntime::patchIonBackedges(JSRuntime* rt, BackedgeTarget target)
|
|||
MOZ_ASSERT(rt->handlingJitInterrupt());
|
||||
}
|
||||
|
||||
// Do nothing if we know all backedges are already jumping to `target`.
|
||||
if (backedgeTarget_ == target)
|
||||
return;
|
||||
|
||||
backedgeTarget_ = target;
|
||||
|
||||
backedgeExecAlloc_.makeAllWritable();
|
||||
|
||||
// Patch all loop backedges in Ion code so that they either jump to the
|
||||
|
@ -1147,11 +1154,9 @@ IonScript::copyPatchableBackedges(JSContext* cx, JitCode* code,
|
|||
CodeLocationLabel interruptCheck(code, CodeOffset(info.interruptCheck->offset()));
|
||||
new(patchableBackedge) PatchableBackedge(backedge, loopHeader, interruptCheck);
|
||||
|
||||
// Point the backedge to either of its possible targets, according to
|
||||
// whether an interrupt is currently desired, matching the targets
|
||||
// established by ensureIonCodeAccessible() above. We don't handle the
|
||||
// interrupt immediately as the interrupt lock is held here.
|
||||
if (cx->runtime()->hasPendingInterrupt())
|
||||
// Point the backedge to either of its possible targets, matching the
|
||||
// other backedges in the runtime.
|
||||
if (jrt->backedgeTarget() == JitRuntime::BackedgeInterruptCheck)
|
||||
PatchBackedge(backedge, interruptCheck, JitRuntime::BackedgeInterruptCheck);
|
||||
else
|
||||
PatchBackedge(backedge, loopHeader, JitRuntime::BackedgeLoopHeader);
|
||||
|
|
|
@ -82,6 +82,13 @@ class PatchableBackedge : public InlineListNode<PatchableBackedge>
|
|||
|
||||
class JitRuntime
|
||||
{
|
||||
public:
|
||||
enum BackedgeTarget {
|
||||
BackedgeLoopHeader,
|
||||
BackedgeInterruptCheck
|
||||
};
|
||||
|
||||
private:
|
||||
friend class JitCompartment;
|
||||
|
||||
// Executable allocator for all code except asm.js code and Ion code with
|
||||
|
@ -152,7 +159,11 @@ class JitRuntime
|
|||
|
||||
// If true, the signal handler to interrupt Ion code should not attempt to
|
||||
// patch backedges, as we're busy modifying data structures.
|
||||
volatile bool preventBackedgePatching_;
|
||||
mozilla::Atomic<bool> preventBackedgePatching_;
|
||||
|
||||
// Whether patchable backedges currently jump to the loop header or the
|
||||
// interrupt check.
|
||||
BackedgeTarget backedgeTarget_;
|
||||
|
||||
// List of all backedges in all Ion code. The backedge edge list is accessed
|
||||
// asynchronously when the main thread is paused and preventBackedgePatching_
|
||||
|
@ -247,6 +258,9 @@ class JitRuntime
|
|||
bool preventBackedgePatching() const {
|
||||
return preventBackedgePatching_;
|
||||
}
|
||||
BackedgeTarget backedgeTarget() const {
|
||||
return backedgeTarget_;
|
||||
}
|
||||
void addPatchableBackedge(PatchableBackedge* backedge) {
|
||||
MOZ_ASSERT(preventBackedgePatching_);
|
||||
backedgeList_.pushFront(backedge);
|
||||
|
@ -256,11 +270,6 @@ class JitRuntime
|
|||
backedgeList_.remove(backedge);
|
||||
}
|
||||
|
||||
enum BackedgeTarget {
|
||||
BackedgeLoopHeader,
|
||||
BackedgeInterruptCheck
|
||||
};
|
||||
|
||||
void patchIonBackedges(JSRuntime* rt, BackedgeTarget target);
|
||||
|
||||
JitCode* getVMWrapper(const VMFunction& f) const;
|
||||
|
|
Загрузка…
Ссылка в новой задаче