Bug 1885489 - Part 5: Add SnapshotIterator::readInt32(). r=iain
[gecko.git] / js / src / jit / Invalidation.h
blobf0a5410967c91b7dfb6cc2c47f1434ce2b065533
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"
14 namespace js {
15 namespace jit {
17 class IonScript;
19 class RecompileInfo {
20 JSScript* script_;
21 IonCompilationId id_;
23 public:
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,
48 JSScript* script);
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);
56 } // namespace jit
57 } // namespace js
59 #endif /* jit_Invalidation_h */