mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Bug 972087 - Don't store self-hosting name on clones of intrinsic functions. r=jorendorff
This commit is contained in:
parent
4757cb31a4
commit
9dece28c31
@ -1013,16 +1013,19 @@ CloneObject(JSContext *cx, JSObject *selfHostedObject, CloneMemory &clonedObject
|
||||
RootedObject clone(cx);
|
||||
if (selfHostedObject->is<JSFunction>()) {
|
||||
JSFunction *selfHostedFunction = &selfHostedObject->as<JSFunction>();
|
||||
bool hasName = selfHostedFunction->atom() != nullptr;
|
||||
js::gc::AllocKind kind = hasName
|
||||
bool needsName = selfHostedFunction->isInterpreted() &&
|
||||
selfHostedFunction->atom() != nullptr;
|
||||
js::gc::AllocKind kind = needsName
|
||||
? JSFunction::ExtendedFinalizeKind
|
||||
: selfHostedFunction->getAllocKind();
|
||||
clone = CloneFunctionObject(cx, HandleFunction::fromMarkedLocation(&selfHostedFunction),
|
||||
cx->global(), kind, TenuredObject);
|
||||
// To be able to re-lazify the cloned function, its name in the
|
||||
// self-hosting compartment has to be stored on the clone.
|
||||
if (clone && hasName)
|
||||
// To be able to re-lazify cloned interpreted functions, their name in
|
||||
// the self-hosting compartment has to be stored on the clone.
|
||||
if (clone && needsName) {
|
||||
JS_ASSERT(clone->as<JSFunction>().isSelfHostedBuiltin());
|
||||
clone->as<JSFunction>().setExtendedSlot(0, StringValue(selfHostedFunction->atom()));
|
||||
}
|
||||
} else if (selfHostedObject->is<RegExpObject>()) {
|
||||
RegExpObject &reobj = selfHostedObject->as<RegExpObject>();
|
||||
RootedAtom source(cx, reobj.getSource());
|
||||
|
Loading…
Reference in New Issue
Block a user