Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / js / src / jit / ScriptFromCalleeToken.h
bloba4642893a6eef5f89dee6ca2ef79d6047b3781ce
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_ScriptFromCalleeToken_h
8 #define jit_ScriptFromCalleeToken_h
10 #include "mozilla/Assertions.h"
12 #include "jit/CalleeToken.h"
13 #include "js/TypeDecls.h"
14 #include "vm/JSFunction.h"
16 namespace js::jit {
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();
26 MOZ_CRASH("invalid callee token tag");
29 JSScript* MaybeForwardedScriptFromCalleeToken(CalleeToken token);
31 } /* namespace js::jit */
33 #endif /* jit_ScriptFromCalleeToken_h */