XrayJitInfo.h (1662B)
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 /* 8 * JIT info so SpiderMonkey can efficiently work with Gecko XrayWrapper 9 * instances. 10 * 11 * This header is completely irrelevant to non-Gecko embedders. 12 */ 13 14 #ifndef js_friend_XrayJitInfo_h 15 #define js_friend_XrayJitInfo_h 16 17 #include <stddef.h> // size_t 18 19 #include "jstypes.h" // JS_PUBLIC_API 20 21 class JS_PUBLIC_API JSObject; 22 23 namespace js { 24 25 class JS_PUBLIC_API BaseProxyHandler; 26 27 } // namespace js 28 29 namespace JS { 30 31 // Callbacks and other information for use by the JITs when optimizing accesses 32 // on xray wrappers. 33 struct XrayJitInfo { 34 // Test whether a proxy handler is a cross compartment xray with no 35 // security checks. 36 bool (*isCrossCompartmentXray)(const js::BaseProxyHandler* handler); 37 38 // Test whether xrays in |obj|'s compartment have expandos of their own, 39 // instead of sharing them with Xrays from other compartments. 40 bool (*compartmentHasExclusiveExpandos)(JSObject* obj); 41 42 // Proxy reserved slot used by xrays in sandboxes to store their holder 43 // object. 44 size_t xrayHolderSlot; 45 46 // Reserved slot used by xray holders to store the xray's expando object. 47 size_t holderExpandoSlot; 48 49 // Reserved slot used by xray expandos to store a custom prototype. 50 size_t expandoProtoSlot; 51 }; 52 53 extern JS_PUBLIC_API void SetXrayJitInfo(XrayJitInfo* info); 54 55 } // namespace JS 56 57 #endif // js_friend_XrayJitInfo_h