本文整理汇总了C++中JSFunction::needsCallObject方法的典型用法代码示例。如果您正苦于以下问题:C++ JSFunction::needsCallObject方法的具体用法?C++ JSFunction::needsCallObject怎么用?C++ JSFunction::needsCallObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSFunction
的用法示例。
在下文中一共展示了JSFunction::needsCallObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ObjectValue
/* static */ void
ArgumentsObject::MaybeForwardToCallObject(jit::JitFrameLayout* frame, HandleObject callObj,
ArgumentsObject* obj, ArgumentsData* data)
{
JSFunction* callee = jit::CalleeTokenToFunction(frame->calleeToken());
JSScript* script = callee->nonLazyScript();
if (callee->needsCallObject() && script->argsObjAliasesFormals()) {
MOZ_ASSERT(callObj && callObj->is<CallObject>());
obj->initFixedSlot(MAYBE_CALL_SLOT, ObjectValue(*callObj.get()));
for (AliasedFormalIter fi(script); fi; fi++)
data->args[fi.frameIndex()] = MagicScopeSlotValue(fi.scopeSlot());
}
}
示例2: ObjectValue
/* static */ void
ArgumentsObject::MaybeForwardToCallObject(jit::JitFrameLayout* frame, HandleObject callObj,
ArgumentsObject* obj, ArgumentsData* data)
{
JSFunction* callee = jit::CalleeTokenToFunction(frame->calleeToken());
JSScript* script = callee->nonLazyScript();
if (callee->needsCallObject() && script->argumentsAliasesFormals()) {
MOZ_ASSERT(callObj && callObj->is<CallObject>());
obj->initFixedSlot(MAYBE_CALL_SLOT, ObjectValue(*callObj.get()));
for (PositionalFormalParameterIter fi(script); fi; fi++) {
if (fi.closedOver())
data->args[fi.argumentSlot()] = MagicEnvSlotValue(fi.location().slot());
}
}
}
示例3: callObj
/* static */ ArgumentsObject*
ArgumentsObject::finishForIon(JSContext* cx, jit::JitFrameLayout* frame,
JSObject* scopeChain, ArgumentsObject* obj)
{
// JIT code calls this directly (no callVM), because it's faster, so we're
// not allowed to GC in here.
JS::AutoCheckCannotGC nogc;
JSFunction* callee = jit::CalleeTokenToFunction(frame->calleeToken());
RootedObject callObj(cx, scopeChain->is<CallObject>() ? scopeChain : nullptr);
CopyJitFrameArgs copy(frame, callObj);
unsigned numActuals = frame->numActualArgs();
unsigned numFormals = callee->nargs();
unsigned numArgs = Max(numActuals, numFormals);
unsigned numBytes = ArgumentsData::bytesRequired(numArgs);
ArgumentsData* data =
reinterpret_cast<ArgumentsData*>(AllocateObjectBuffer<uint8_t>(cx, obj, numBytes));
if (!data) {
// Make the object safe for GC. Don't report OOM, the slow path will
// retry the allocation.
cx->recoverFromOutOfMemory();
obj->initFixedSlot(DATA_SLOT, PrivateValue(nullptr));
return nullptr;
}
data->numArgs = numArgs;
data->rareData = nullptr;
obj->initFixedSlot(INITIAL_LENGTH_SLOT, Int32Value(numActuals << PACKED_BITS_COUNT));
obj->initFixedSlot(DATA_SLOT, PrivateValue(data));
obj->initFixedSlot(MAYBE_CALL_SLOT, UndefinedValue());
obj->initFixedSlot(CALLEE_SLOT, ObjectValue(*callee));
copy.copyArgs(cx, data->args, numArgs);
if (callObj && callee->needsCallObject())
copy.maybeForwardToCallObject(obj, data);
MOZ_ASSERT(obj->initialLength() == numActuals);
MOZ_ASSERT(!obj->hasOverriddenLength());
return obj;
}