Bug 1668576 - Part 4: Remove GetFunctionObjectNative and inline FunctionObject{ToShadowFunction,IsNative}. r=tcampbell

These were added in bug 1140399, but nowadays they're only used in
`FUNCTION_VALUE_TO_JITINFO`. Inline them into `FUNCTION_VALUE_TO_JITINFO` and
remove the rest.

Differential Revision: https://phabricator.services.mozilla.com/D92076
This commit is contained in:
André Bargull 2020-10-09 13:50:53 +00:00
Родитель 4124b95613
Коммит fa9b50064f
1 изменённых файлов: 8 добавлений и 19 удалений

Просмотреть файл

@ -621,32 +621,21 @@ extern JS_FRIEND_API uint64_t GetSCOffset(JSStructuredCloneWriter* writer);
namespace js {
static MOZ_ALWAYS_INLINE JS::shadow::Function* FunctionObjectToShadowFunction(
JSObject* fun) {
MOZ_ASSERT(JS::GetClass(fun) == FunctionClassPtr);
return reinterpret_cast<JS::shadow::Function*>(fun);
}
/* Statically asserted in FunctionFlags.cpp. */
static const unsigned JS_FUNCTION_INTERPRETED_BITS = 0x0060;
// Return whether the given function object is native.
static MOZ_ALWAYS_INLINE bool FunctionObjectIsNative(JSObject* fun) {
return !(FunctionObjectToShadowFunction(fun)->flags &
JS_FUNCTION_INTERPRETED_BITS);
}
static MOZ_ALWAYS_INLINE JSNative GetFunctionObjectNative(JSObject* fun) {
MOZ_ASSERT(FunctionObjectIsNative(fun));
return FunctionObjectToShadowFunction(fun)->native;
}
} // namespace js
static MOZ_ALWAYS_INLINE const JSJitInfo* FUNCTION_VALUE_TO_JITINFO(
const JS::Value& v) {
MOZ_ASSERT(js::FunctionObjectIsNative(&v.toObject()));
return js::FunctionObjectToShadowFunction(&v.toObject())->jitinfo;
JSObject* obj = &v.toObject();
MOZ_ASSERT(JS::GetClass(obj) == js::FunctionClassPtr);
auto* fun = reinterpret_cast<JS::shadow::Function*>(obj);
MOZ_ASSERT(!(fun->flags & js::JS_FUNCTION_INTERPRETED_BITS),
"Unexpected non-native function");
return fun->jitinfo;
}
static MOZ_ALWAYS_INLINE void SET_JITINFO(JSFunction* func,