tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

JitScript-inl.h (1144B)


      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_JitScript_inl_h
      8 #define jit_JitScript_inl_h
      9 
     10 #include "jit/JitScript.h"
     11 
     12 #include "mozilla/Assertions.h"
     13 
     14 #include "gc/Zone.h"
     15 #include "jit/JitZone.h"
     16 #include "vm/JSContext.h"
     17 #include "vm/JSScript.h"
     18 
     19 namespace js {
     20 namespace jit {
     21 
     22 inline AutoKeepJitScripts::AutoKeepJitScripts(JSContext* cx)
     23    : zone_(cx->zone()->jitZone()), prev_(zone_->keepJitScripts()) {
     24  zone_->setKeepJitScripts(true);
     25 }
     26 
     27 inline AutoKeepJitScripts::~AutoKeepJitScripts() {
     28  MOZ_ASSERT(zone_->keepJitScripts());
     29  zone_->setKeepJitScripts(prev_);
     30 }
     31 
     32 }  // namespace jit
     33 }  // namespace js
     34 
     35 inline bool JSScript::ensureHasJitScript(JSContext* cx,
     36                                         js::jit::AutoKeepJitScripts&) {
     37  if (hasJitScript()) {
     38    return true;
     39  }
     40  return createJitScript(cx);
     41 }
     42 
     43 #endif /* jit_JitScript_inl_h */