本文整理汇总了C++中JSScript::getStaticBlockScope方法的典型用法代码示例。如果您正苦于以下问题:C++ JSScript::getStaticBlockScope方法的具体用法?C++ JSScript::getStaticBlockScope怎么用?C++ JSScript::getStaticBlockScope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSScript
的用法示例。
在下文中一共展示了JSScript::getStaticBlockScope方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replaceCalleeToken
void
BaselineFrame::trace(JSTracer* trc, JitFrameIterator& frameIterator)
{
replaceCalleeToken(MarkCalleeToken(trc, calleeToken()));
TraceRoot(trc, &thisValue(), "baseline-this");
// Mark actual and formal args.
if (isNonEvalFunctionFrame()) {
unsigned numArgs = js::Max(numActualArgs(), numFormalArgs());
TraceRootRange(trc, numArgs + isConstructing(), argv(), "baseline-args");
}
// Mark scope chain, if it exists.
if (scopeChain_)
TraceRoot(trc, &scopeChain_, "baseline-scopechain");
// Mark return value.
if (hasReturnValue())
TraceRoot(trc, returnValue().address(), "baseline-rval");
if (isEvalFrame()) {
TraceRoot(trc, &evalScript_, "baseline-evalscript");
TraceRoot(trc, evalNewTargetAddress(), "baseline-evalNewTarget");
}
if (hasArgsObj())
TraceRoot(trc, &argsObj_, "baseline-args-obj");
// Mark locals and stack values.
JSScript* script = this->script();
size_t nfixed = script->nfixed();
size_t nlivefixed = script->nbodyfixed();
if (nfixed != nlivefixed) {
jsbytecode* pc;
frameIterator.baselineScriptAndPc(nullptr, &pc);
NestedScopeObject* staticScope = script->getStaticBlockScope(pc);
while (staticScope && !staticScope->is<StaticBlockObject>())
staticScope = staticScope->enclosingNestedScope();
if (staticScope) {
StaticBlockObject& blockObj = staticScope->as<StaticBlockObject>();
nlivefixed = blockObj.localOffset() + blockObj.numVariables();
}
}
MOZ_ASSERT(nlivefixed <= nfixed);
MOZ_ASSERT(nlivefixed >= script->nbodyfixed());
// NB: It is possible that numValueSlots() could be zero, even if nfixed is
// nonzero. This is the case if the function has an early stack check.
if (numValueSlots() == 0)
return;
MOZ_ASSERT(nfixed <= numValueSlots());
if (nfixed == nlivefixed) {
// All locals are live.
MarkLocals(this, trc, 0, numValueSlots());
} else {
// Mark operand stack.
MarkLocals(this, trc, nfixed, numValueSlots());
// Clear dead block-scoped locals.
while (nfixed > nlivefixed)
unaliasedLocal(--nfixed).setMagic(JS_UNINITIALIZED_LEXICAL);
// Mark live locals.
MarkLocals(this, trc, 0, nlivefixed);
}
}