mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1236519 - Ensure JSFunction::isDerivedClassConstructor properly handles lazy self-hosted functions. r=till a=bustage
This commit is contained in:
parent
0506fad16e
commit
4106614ca3
@ -1294,6 +1294,30 @@ JSFunction::infallibleIsDefaultClassConstructor(JSContext* cx) const
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
bool
|
||||
JSFunction::isDerivedClassConstructor()
|
||||
{
|
||||
bool derived;
|
||||
if (isInterpretedLazy()) {
|
||||
// There is only one plausible lazy self-hosted derived
|
||||
// constructor.
|
||||
if (isSelfHostedBuiltin()) {
|
||||
JSAtom* name = &getExtendedSlot(LAZY_FUNCTION_NAME_SLOT).toString()->asAtom();
|
||||
|
||||
// This function is called from places without access to a
|
||||
// JSContext. Trace some plumbing to get what we want.
|
||||
derived = name == compartment()->runtimeFromAnyThread()->
|
||||
commonNames->DefaultDerivedClassConstructor;
|
||||
} else {
|
||||
derived = lazyScript()->isDerivedClassConstructor();
|
||||
}
|
||||
} else {
|
||||
derived = nonLazyScript()->isDerivedClassConstructor();
|
||||
}
|
||||
MOZ_ASSERT_IF(derived, isClassConstructor());
|
||||
return derived;
|
||||
}
|
||||
|
||||
bool
|
||||
JSFunction::getLength(JSContext* cx, uint16_t* length)
|
||||
{
|
||||
|
@ -538,15 +538,7 @@ class JSFunction : public js::NativeObject
|
||||
u.n.jitinfo = data;
|
||||
}
|
||||
|
||||
bool isDerivedClassConstructor() {
|
||||
bool derived;
|
||||
if (isInterpretedLazy())
|
||||
derived = lazyScript()->isDerivedClassConstructor();
|
||||
else
|
||||
derived = nonLazyScript()->isDerivedClassConstructor();
|
||||
MOZ_ASSERT_IF(derived, isClassConstructor());
|
||||
return derived;
|
||||
}
|
||||
bool isDerivedClassConstructor();
|
||||
|
||||
static unsigned offsetOfNativeOrScript() {
|
||||
static_assert(offsetof(U, n.native) == offsetof(U, i.s.script_),
|
||||
|
Loading…
Reference in New Issue
Block a user