1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef jit_Invalidation_h
8 #define jit_Invalidation_h
10 #include "jit/IonTypes.h"
11 #include "js/AllocPolicy.h"
12 #include "js/GCVector.h"
24 RecompileInfo(JSScript
* script
, IonCompilationId id
)
25 : script_(script
), id_(id
) {}
27 JSScript
* script() const { return script_
; }
29 IonScript
* maybeIonScriptToInvalidate() const;
31 bool traceWeak(JSTracer
* trc
);
33 bool operator==(const RecompileInfo
& other
) const {
34 return script_
== other
.script_
&& id_
== other
.id_
;
38 // The RecompileInfoVector has a MinInlineCapacity of one so that invalidating a
39 // single IonScript doesn't require an allocation.
40 using RecompileInfoVector
= JS::GCVector
<RecompileInfo
, 1, SystemAllocPolicy
>;
42 // Called from Zone::discardJitCode().
43 void InvalidateAll(JS::GCContext
* gcx
, JS::Zone
* zone
);
44 void FinishInvalidation(JS::GCContext
* gcx
, JSScript
* script
);
46 // Add compilations involving |script| (outer script or inlined) to the vector.
47 void AddPendingInvalidation(jit::RecompileInfoVector
& invalid
,
50 // Walk the stack and invalidate active Ion frames for the invalid scripts.
51 void Invalidate(JSContext
* cx
, const RecompileInfoVector
& invalid
,
52 bool resetUses
= true, bool cancelOffThread
= true);
53 void Invalidate(JSContext
* cx
, JSScript
* script
, bool resetUses
= true,
54 bool cancelOffThread
= true);
59 #endif /* jit_Invalidation_h */