Debian Codegraph @

js/src/jit/InvalidationScriptSet.h

raw
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/. */
6
7 #ifndef jit_InvalidationScriptSet_h
8 #define jit_InvalidationScriptSet_h
9
10 #include "gc/Barrier.h"
11 #include "jit/IonTypes.h"
12 #include "js/AllocPolicy.h"
13 #include "js/GCVector.h"
14 #include "js/SweepingAPI.h"
15
16 class JSScript;
17
18 namespace js::jit {
19
20 using WeakScriptSet =
21 GCHashSet<WeakHeapPtr<JSScript*>, StableCellHasher<WeakHeapPtr<JSScript*>>,
22 js::SystemAllocPolicy>;
23
24 // A weak cache of scripts all of which will be invalidated simultaneously.
25 using WeakScriptCache = JS::WeakCache<WeakScriptSet>;
26
27 void InvalidateAndClearScriptSet(JSContext* cx, WeakScriptCache& scripts,
28 const char* reason);
29 bool AddScriptToSet(WeakScriptCache& scripts, Handle<JSScript*> script);
30
31 // Remove a script from a script set if found.
32 void RemoveFromScriptSet(WeakScriptCache& scripts, JSScript* script);
33
34 } // namespace js::jit
35
36 #endif /* jit_InvalidationScriptSet_h */