tor-browser

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

ScriptFromCalleeToken.h (1023B)


      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_ScriptFromCalleeToken_h
      8 #define jit_ScriptFromCalleeToken_h
      9 
     10 #include "mozilla/Assertions.h"
     11 
     12 #include "jit/CalleeToken.h"
     13 #include "js/TypeDecls.h"
     14 #include "vm/JSFunction.h"
     15 
     16 namespace js::jit {
     17 
     18 static inline JSScript* ScriptFromCalleeToken(CalleeToken token) {
     19  switch (GetCalleeTokenTag(token)) {
     20    case CalleeToken_Script:
     21      return CalleeTokenToScript(token);
     22    case CalleeToken_Function:
     23    case CalleeToken_FunctionConstructing:
     24      return CalleeTokenToFunction(token)->nonLazyScript();
     25  }
     26  MOZ_CRASH("invalid callee token tag");
     27 }
     28 
     29 JSScript* MaybeForwardedScriptFromCalleeToken(CalleeToken token);
     30 
     31 } /* namespace js::jit */
     32 
     33 #endif /* jit_ScriptFromCalleeToken_h */