Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / js / src / jit / JitScript-inl.h
blobe27745ffab5ddae4201f8b77c29c0b4ef4bee645
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_JitScript_inl_h
8 #define jit_JitScript_inl_h
10 #include "jit/JitScript.h"
12 #include "mozilla/Assertions.h"
14 #include "gc/Zone.h"
15 #include "jit/JitZone.h"
16 #include "vm/JSContext.h"
17 #include "vm/JSScript.h"
19 namespace js {
20 namespace jit {
22 inline AutoKeepJitScripts::AutoKeepJitScripts(JSContext* cx)
23 : zone_(cx->zone()->jitZone()), prev_(zone_->keepJitScripts()) {
24 zone_->setKeepJitScripts(true);
27 inline AutoKeepJitScripts::~AutoKeepJitScripts() {
28 MOZ_ASSERT(zone_->keepJitScripts());
29 zone_->setKeepJitScripts(prev_);
32 } // namespace jit
33 } // namespace js
35 inline bool JSScript::ensureHasJitScript(JSContext* cx,
36 js::jit::AutoKeepJitScripts&) {
37 if (hasJitScript()) {
38 return true;
40 return createJitScript(cx);
43 #endif /* jit_JitScript_inl_h */