Bug 1787406 - Part 11: Inline CallObject::create() function into its only caller. r=jandem

Depends on D155683

Differential Revision: https://phabricator.services.mozilla.com/D155684
This commit is contained in:
André Bargull 2022-08-26 14:24:11 +00:00
Родитель 1948a4d2ca
Коммит 8b32b89094
2 изменённых файлов: 7 добавлений и 26 удалений

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

@ -107,8 +107,7 @@ static T* CreateEnvironmentObject(JSContext* cx, Handle<Shape*> shape,
}
CallObject* CallObject::create(JSContext* cx, Handle<Shape*> shape) {
gc::InitialHeap heap = GetInitialHeap(GenericObject, &class_);
return CreateEnvironmentObject<CallObject>(cx, shape, heap);
return CreateEnvironmentObject<CallObject>(cx, shape);
}
/*
@ -148,39 +147,23 @@ CallObject* CallObject::createTemplateObject(JSContext* cx, HandleScript script,
return callObj;
}
/*
* Construct a call object for the given bindings. If this is a call object
* for a function invocation, callee should be the function being called.
* Otherwise it must be a call object for eval of strict mode code, and callee
* must be null.
*/
CallObject* CallObject::create(JSContext* cx, HandleFunction callee,
HandleObject enclosing) {
RootedScript script(cx, callee->nonLazyScript());
gc::InitialHeap heap = gc::DefaultHeap;
CallObject* callobj =
CallObject::createTemplateObject(cx, script, enclosing, heap);
if (!callobj) {
return nullptr;
}
callobj->initFixedSlot(CALLEE_SLOT, ObjectValue(*callee));
return callobj;
}
CallObject* CallObject::create(JSContext* cx, AbstractFramePtr frame) {
MOZ_ASSERT(frame.isFunctionFrame());
cx->check(frame);
RootedObject envChain(cx, frame.environmentChain());
RootedFunction callee(cx, frame.callee());
RootedScript script(cx, callee->nonLazyScript());
CallObject* callobj = create(cx, callee, envChain);
gc::InitialHeap heap = gc::DefaultHeap;
CallObject* callobj =
CallObject::createTemplateObject(cx, script, envChain, heap);
if (!callobj) {
return nullptr;
}
callobj->initFixedSlot(CALLEE_SLOT, ObjectValue(*callee));
if (!frame.script()->bodyScope()->as<FunctionScope>().hasParameterExprs()) {
// If there are no defaults, copy the aliased arguments into the call
// object manually. If there are defaults, bytecode is generated to do

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

@ -342,8 +342,6 @@ class CallObject : public EnvironmentObject {
HandleObject enclosing,
gc::InitialHeap heap);
static CallObject* create(JSContext* cx, HandleFunction callee,
HandleObject enclosing);
static CallObject* create(JSContext* cx, AbstractFramePtr frame);
static CallObject* createHollowForDebug(JSContext* cx, HandleFunction callee);