Bumping manifests a=b2g-bump
[gecko.git] / js / src / frontend / ParseMaps-inl.h
blob6a66b71a99d21350c9ac7c003b90574ca0936648
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sts=4 et sw=4 tw=99:
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 frontend_ParseMaps_inl_h
8 #define frontend_ParseMaps_inl_h
10 #include "frontend/ParseMaps.h"
12 #include "jscntxtinlines.h"
14 namespace js {
15 namespace frontend {
17 template <class Map>
18 inline bool
19 AtomThingMapPtr<Map>::ensureMap(ExclusiveContext *cx)
21 if (map_)
22 return true;
24 AutoLockForExclusiveAccess lock(cx);
25 map_ = cx->parseMapPool().acquire<Map>();
26 return !!map_;
29 template <class Map>
30 inline void
31 AtomThingMapPtr<Map>::releaseMap(ExclusiveContext *cx)
33 if (!map_)
34 return;
36 AutoLockForExclusiveAccess lock(cx);
37 cx->parseMapPool().release(map_);
38 map_ = nullptr;
41 template <typename ParseHandler>
42 inline bool
43 AtomDecls<ParseHandler>::init()
45 AutoLockForExclusiveAccess lock(cx);
46 map = cx->parseMapPool().acquire<AtomDefnListMap>();
47 return map;
50 template <typename ParseHandler>
51 inline
52 AtomDecls<ParseHandler>::~AtomDecls()
54 if (map) {
55 AutoLockForExclusiveAccess lock(cx);
56 cx->parseMapPool().release(map);
60 } /* namespace frontend */
61 } /* namespace js */
63 #endif /* frontend_ParseMaps_inl_h */