Function.h (1349B)
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 /* Shadow definition of |JSFunction| innards. Do not use this directly! */ 8 9 #ifndef js_shadow_Function_h 10 #define js_shadow_Function_h 11 12 #include <stdint.h> // uint16_t 13 14 #include "jstypes.h" // JS_PUBLIC_API 15 16 #include "js/CallArgs.h" // JSNative 17 #include "js/shadow/Object.h" // JS::shadow::Object 18 #include "js/Value.h" // JS::Value 19 20 class JS_PUBLIC_API JSFunction; 21 class JSJitInfo; 22 23 namespace JS { 24 25 namespace shadow { 26 27 struct Function : shadow::Object { 28 enum { 29 FlagsAndArgCountSlot, 30 NativeFuncOrInterpretedEnvSlot, 31 NativeJitInfoOrInterpretedScriptSlot, 32 AtomSlot 33 }; 34 uint32_t flagsAndArgCount() const { 35 return fixedSlots()[FlagsAndArgCountSlot].toPrivateUint32(); 36 } 37 38 void* jitInfoOrScript() const { 39 return fixedSlots()[NativeJitInfoOrInterpretedScriptSlot].toPrivate(); 40 } 41 42 void setJitInfoOrScript(void* ptr) { 43 fixedSlots()[NativeJitInfoOrInterpretedScriptSlot] = JS::PrivateValue(ptr); 44 } 45 }; 46 47 } // namespace shadow 48 49 } // namespace JS 50 51 #endif // js_shadow_Function_h