这篇教程C++ AbstractFramePtr类代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AbstractFramePtr类的典型用法代码示例。如果您正苦于以下问题:C++ AbstractFramePtr类的具体用法?C++ AbstractFramePtr怎么用?C++ AbstractFramePtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。 在下文中一共展示了AbstractFramePtr类的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: valboolGeneratorObject::suspend(JSContext *cx, HandleObject obj, AbstractFramePtr frame, jsbytecode *pc, Value *vp, unsigned nvalues){ MOZ_ASSERT(*pc == JSOP_INITIALYIELD || *pc == JSOP_YIELD); Rooted<GeneratorObject*> genObj(cx, &obj->as<GeneratorObject>()); MOZ_ASSERT(!genObj->hasExpressionStack()); if (*pc == JSOP_YIELD && genObj->isClosing() && genObj->is<LegacyGeneratorObject>()) { RootedValue val(cx, ObjectValue(*frame.callee())); js_ReportValueError(cx, JSMSG_BAD_GENERATOR_YIELD, JSDVG_IGNORE_STACK, val, NullPtr()); return false; } uint32_t yieldIndex = GET_UINT24(pc); genObj->setYieldIndex(yieldIndex); genObj->setScopeChain(*frame.scopeChain()); if (nvalues) { ArrayObject *stack = NewDenseCopiedArray(cx, nvalues, vp); if (!stack) return false; genObj->setExpressionStack(*stack); } return true;}
开发者ID:fatman2021,项目名称:gecko-dev,代码行数:28,
示例2: skipCharsboolJSAbstractFramePtr::evaluateUCInStackFrame(JSContext *cx, const jschar *chars, unsigned length, const char *filename, unsigned lineno, MutableHandleValue rval){ /* Protect inlined chars from root analysis poisoning. */ SkipRoot skipChars(cx, &chars); if (!CheckDebugMode(cx)) return false; RootedObject scope(cx, scopeChain(cx)); Rooted<Env*> env(cx, scope); if (!env) return false; AbstractFramePtr frame = Valueify(*this); if (!ComputeThis(cx, frame)) return false; RootedValue thisv(cx, frame.thisValue()); js::AutoCompartment ac(cx, env); return EvaluateInEnv(cx, env, thisv, frame, StableCharPtr(chars, length), length, filename, lineno, rval);}
开发者ID:drexler,项目名称:releases-mozilla-aurora,代码行数:26,
示例3: ValueifyJSObject *JSAbstractFramePtr::scopeChain(JSContext *cx){ AbstractFramePtr frame = Valueify(*this); RootedObject scopeChain(cx, frame.scopeChain()); AutoCompartment ac(cx, scopeChain); return GetDebugScopeForFrame(cx, frame);}
开发者ID:drexler,项目名称:releases-mozilla-aurora,代码行数:8,
示例4: ObjectValue/* static */ voidArgumentsObject::MaybeForwardToCallObject(AbstractFramePtr frame, ArgumentsObject* obj, ArgumentsData* data){ JSScript* script = frame.script(); if (frame.fun()->needsCallObject() && script->argsObjAliasesFormals()) { obj->initFixedSlot(MAYBE_CALL_SLOT, ObjectValue(frame.callObj())); for (AliasedFormalIter fi(script); fi; fi++) data->args[fi.frameIndex()] = MagicScopeSlotValue(fi.scopeSlot()); }}
开发者ID:TechnoAyan,项目名称:gecko-dev,代码行数:11,
示例5: // Initialize the decl env Object, call object, and any arguments obj of the current frame.booljit::EnsureHasScopeObjects(JSContext* cx, AbstractFramePtr fp){ if (fp.isFunctionFrame() && fp.fun()->isHeavyweight() && !fp.hasCallObj()) { return fp.initFunctionScopeObjects(cx); } return true;}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:12,
示例6: switchFrameIter &FrameIter::operator++(){ switch (data_.state_) { case DONE: MOZ_ASSUME_UNREACHABLE("Unexpected state"); case INTERP: if (interpFrame()->isDebuggerFrame() && interpFrame()->evalInFramePrev()) { AbstractFramePtr eifPrev = interpFrame()->evalInFramePrev(); MOZ_ASSERT(!eifPrev.isRematerializedFrame()); // Eval-in-frame can cross contexts and works across saved frame // chains. ContextOption prevContextOption = data_.contextOption_; SavedOption prevSavedOption = data_.savedOption_; data_.contextOption_ = ALL_CONTEXTS; data_.savedOption_ = GO_THROUGH_SAVED; popInterpreterFrame(); while (isIon() || abstractFramePtr() != eifPrev) { if (data_.state_ == JIT) {#ifdef JS_ION popJitFrame();#else MOZ_ASSUME_UNREACHABLE("Invalid state");#endif } else { popInterpreterFrame(); } } data_.contextOption_ = prevContextOption; data_.savedOption_ = prevSavedOption; data_.cx_ = data_.activations_->cx(); break; } popInterpreterFrame(); break;#ifdef JS_ION case JIT: popJitFrame(); break; case ASMJS: popAsmJSFrame(); break;#else default: MOZ_ASSUME_UNREACHABLE("Unexpected state");#endif } return *this;}
开发者ID:aeddi,项目名称:gecko-dev,代码行数:53,
示例7: ObjectValue/* static */ voidArgumentsObject::MaybeForwardToCallObject(AbstractFramePtr frame, ArgumentsObject* obj, ArgumentsData* data){ JSScript* script = frame.script(); if (frame.callee()->needsCallObject() && script->argumentsAliasesFormals()) { obj->initFixedSlot(MAYBE_CALL_SLOT, ObjectValue(frame.callObj())); for (PositionalFormalParameterIter fi(script); fi; fi++) { if (fi.closedOver()) data->args[fi.argumentSlot()] = MagicEnvSlotValue(fi.location().slot()); } }}
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:13,
示例8: CopyStackFrameArgumentsstatic voidCopyStackFrameArguments(const AbstractFramePtr frame, HeapValue* dst, unsigned totalArgs){ MOZ_ASSERT_IF(frame.isInterpreterFrame(), !frame.asInterpreterFrame()->runningInJit()); MOZ_ASSERT(Max(frame.numActualArgs(), frame.numFormalArgs()) == totalArgs); /* Copy arguments. */ Value* src = frame.argv(); Value* end = src + totalArgs; while (src != end) (dst++)->init(*src++);}
开发者ID:TechnoAyan,项目名称:gecko-dev,代码行数:13,
示例9: JsvalifyJSTrapStatusjs::ScriptDebugPrologue(JSContext *cx, AbstractFramePtr frame){ JS_ASSERT_IF(frame.isStackFrame(), frame.asStackFrame() == cx->fp()); if (frame.isFramePushedByExecute()) { if (JSInterpreterHook hook = cx->runtime->debugHooks.executeHook) frame.setHookData(hook(cx, Jsvalify(frame.asStackFrame()), true, 0, cx->runtime->debugHooks.executeHookData)); } else { if (JSInterpreterHook hook = cx->runtime->debugHooks.callHook) frame.setHookData(hook(cx, Jsvalify(frame.asStackFrame()), true, 0, cx->runtime->debugHooks.callHookData)); } Value rval; JSTrapStatus status = Debugger::onEnterFrame(cx, &rval); switch (status) { case JSTRAP_CONTINUE: break; case JSTRAP_THROW: cx->setPendingException(rval); break; case JSTRAP_ERROR: cx->clearPendingException(); break; case JSTRAP_RETURN: frame.setReturnValue(rval); break; default: JS_NOT_REACHED("bad Debugger::onEnterFrame JSTrapStatus value"); } return status;}
开发者ID:kjozwiak,项目名称:mozilla-central,代码行数:34,
示例10: // Initialize the decl env Object, call object, and any arguments obj of the current frame.booljit::EnsureHasScopeObjects(JSContext* cx, AbstractFramePtr fp){ // Ion does not compile eval scripts. MOZ_ASSERT(!fp.isEvalFrame()); if (fp.isFunctionFrame() && fp.callee()->needsCallObject() && !fp.hasCallObj()) { return fp.initFunctionScopeObjects(cx); } return true;}
开发者ID:tungmangtdh3,项目名称:gecko-dev,代码行数:15,
示例11: booljs::GeneratorThrowOrClose(JSContext *cx, AbstractFramePtr frame, Handle<GeneratorObject*> genObj, HandleValue arg, uint32_t resumeKind){ if (resumeKind == GeneratorObject::THROW) { cx->setPendingException(arg); genObj->setRunning(); } else { MOZ_ASSERT(resumeKind == GeneratorObject::CLOSE); if (genObj->is<StarGeneratorObject>()) { // Store the return value in the frame's CallObject so that we can // return it after executing finally blocks (and potentially // yielding again). MOZ_ASSERT(arg.isObject()); CallObject &callObj = frame.callObj(); Shape *shape = callObj.lookup(cx, cx->names().dotGenRVal); callObj.setSlot(shape->slot(), arg); } else { MOZ_ASSERT(arg.isUndefined()); } cx->setPendingException(MagicValue(JS_GENERATOR_CLOSING)); genObj->setClosing(); } return false;}
开发者ID:fatman2021,项目名称:gecko-dev,代码行数:27,
示例12: iterbooljs::DirectEval(JSContext* cx, HandleValue v, MutableHandleValue vp){ // Direct eval can assume it was called from an interpreted or baseline frame. ScriptFrameIter iter(cx, FrameIter::GO_THROUGH_SAVED); AbstractFramePtr caller = iter.abstractFramePtr(); MOZ_ASSERT(JSOp(*iter.pc()) == JSOP_EVAL || JSOp(*iter.pc()) == JSOP_STRICTEVAL || JSOp(*iter.pc()) == JSOP_SPREADEVAL || JSOp(*iter.pc()) == JSOP_STRICTSPREADEVAL); MOZ_ASSERT(caller.compartment() == caller.script()->compartment()); RootedObject scopeChain(cx, caller.scopeChain()); return EvalKernel(cx, v, DIRECT_EVAL, caller, scopeChain, iter.pc(), vp);}
开发者ID:emilio,项目名称:gecko-dev,代码行数:16,
示例13: iterbooljs::DirectEval(JSContext* cx, const CallArgs& args){ // Direct eval can assume it was called from an interpreted or baseline frame. ScriptFrameIter iter(cx); AbstractFramePtr caller = iter.abstractFramePtr(); MOZ_ASSERT(caller.scopeChain()->global().valueIsEval(args.calleev())); MOZ_ASSERT(JSOp(*iter.pc()) == JSOP_EVAL || JSOp(*iter.pc()) == JSOP_STRICTEVAL || JSOp(*iter.pc()) == JSOP_SPREADEVAL || JSOp(*iter.pc()) == JSOP_STRICTSPREADEVAL); MOZ_ASSERT(caller.compartment() == caller.script()->compartment()); RootedObject scopeChain(cx, caller.scopeChain()); return EvalKernel(cx, args, DIRECT_EVAL, caller, scopeChain, iter.pc());}
开发者ID:shockkolate,项目名称:gecko-dev,代码行数:17,
示例14: voidjs::SetReturnValueForClosingGenerator(JSContext* cx, AbstractFramePtr frame){ CallObject& callObj = frame.callObj(); // Get the generator object stored on the scope chain and close it. Shape* shape = callObj.lookup(cx, cx->names().dotGenerator); GeneratorObject& genObj = callObj.getSlot(shape->slot()).toObject().as<GeneratorObject>(); genObj.setClosed(); // Return value is already set in GeneratorThrowOrClose. if (genObj.is<StarGeneratorObject>()) return; // Legacy generator .close() always returns |undefined|. MOZ_ASSERT(genObj.is<LegacyGeneratorObject>()); frame.setReturnValue(UndefinedValue());}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:18,
示例15: onLeaveFramebooljs::ScriptDebugEpilogue(JSContext *cx, AbstractFramePtr frame, bool okArg){ JS_ASSERT_IF(frame.isStackFrame(), frame.asStackFrame() == cx->fp()); JSBool ok = okArg; if (void *hookData = frame.maybeHookData()) { if (frame.isFramePushedByExecute()) { if (JSInterpreterHook hook = cx->runtime->debugHooks.executeHook) hook(cx, Jsvalify(frame), IsTopFrameConstructing(cx, frame), false, &ok, hookData); } else { if (JSInterpreterHook hook = cx->runtime->debugHooks.callHook) hook(cx, Jsvalify(frame), IsTopFrameConstructing(cx, frame), false, &ok, hookData); } } return Debugger::onLeaveFrame(cx, ok);}
开发者ID:gdestuynder,项目名称:mozilla-central,代码行数:18,
示例16: onLeaveFramebooljs::ScriptDebugEpilogue(JSContext *cx, AbstractFramePtr frame, bool okArg){ JS_ASSERT_IF(frame.isStackFrame(), frame.asStackFrame() == cx->interpreterFrame()); bool ok = okArg; // We don't add hook data for self-hosted scripts, so we don't need to check for them, here. if (void *hookData = frame.maybeHookData()) { if (frame.isFramePushedByExecute()) { if (JSInterpreterHook hook = cx->runtime()->debugHooks.executeHook) hook(cx, Jsvalify(frame), IsTopFrameConstructing(cx, frame), false, &ok, hookData); } else { if (JSInterpreterHook hook = cx->runtime()->debugHooks.callHook) hook(cx, Jsvalify(frame), IsTopFrameConstructing(cx, frame), false, &ok, hookData); } } return Debugger::onLeaveFrame(cx, frame, ok);}
开发者ID:drexler,项目名称:releases-mozilla-aurora,代码行数:20,
示例17: UndefinedValuevoidjs::SetReturnValueForClosingGenerator(JSContext *cx, AbstractFramePtr frame){ CallObject &callObj = frame.callObj(); // Get the generator object stored on the scope chain and close it. Shape *shape = callObj.lookup(cx, cx->names().dotGenerator); GeneratorObject &genObj = callObj.getSlot(shape->slot()).toObject().as<GeneratorObject>(); genObj.setClosed(); Value v; if (genObj.is<StarGeneratorObject>()) { // The return value is stored in the .genrval slot. shape = callObj.lookup(cx, cx->names().dotGenRVal); v = callObj.getSlot(shape->slot()); } else { // Legacy generator .close() always returns |undefined|. MOZ_ASSERT(genObj.is<LegacyGeneratorObject>()); v = UndefinedValue(); } frame.setReturnValue(v);}
开发者ID:fatman2021,项目名称:gecko-dev,代码行数:23,
示例18: iterbooljs::DirectEval(JSContext *cx, const CallArgs &args){ // Direct eval can assume it was called from an interpreted or baseline frame. ScriptFrameIter iter(cx); AbstractFramePtr caller = iter.abstractFramePtr(); JS_ASSERT(IsBuiltinEvalForScope(caller.scopeChain(), args.calleev())); JS_ASSERT(JSOp(*iter.pc()) == JSOP_EVAL); JS_ASSERT_IF(caller.isFunctionFrame(), caller.compartment() == caller.callee()->compartment()); if (!WarnOnTooManyArgs(cx, args)) return false; RootedObject scopeChain(cx, caller.scopeChain()); return EvalKernel(cx, args, DIRECT_EVAL, caller, scopeChain, iter.pc());}
开发者ID:chiehwen,项目名称:mozilla-central,代码行数:18,
示例19: // Initialize the decl env Object, call object, and any arguments obj of the// current frame.booljit::EnsureHasEnvironmentObjects(JSContext* cx, AbstractFramePtr fp){ // Ion does not compile eval scripts. MOZ_ASSERT(!fp.isEvalFrame()); if (fp.isFunctionFrame()) { // Ion does not handle extra var environments due to parameter // expressions yet. MOZ_ASSERT(!fp.callee()->needsExtraBodyVarEnvironment()); if (!fp.hasInitialEnvironment() && fp.callee()->needsFunctionEnvironmentObjects()) { if (!fp.initFunctionEnvironmentObjects(cx)) return false; } } return true;}
开发者ID:mykmelez,项目名称:spidernode,代码行数:21,
示例20: EvalKernel// Common code implementing direct and indirect eval.//// Evaluate call.argv[2], if it is a string, in the context of the given calling// frame, with the provided scope chain, with the semantics of either a direct// or indirect eval (see ES5 10.4.2). If this is an indirect eval, scopeobj// must be a global object.//// On success, store the completion value in call.rval and return true.static boolEvalKernel(JSContext* cx, HandleValue v, EvalType evalType, AbstractFramePtr caller, HandleObject scopeobj, jsbytecode* pc, MutableHandleValue vp){ MOZ_ASSERT((evalType == INDIRECT_EVAL) == !caller); MOZ_ASSERT((evalType == INDIRECT_EVAL) == !pc); MOZ_ASSERT_IF(evalType == INDIRECT_EVAL, IsGlobalLexicalScope(scopeobj)); AssertInnerizedScopeChain(cx, *scopeobj); Rooted<GlobalObject*> scopeObjGlobal(cx, &scopeobj->global()); if (!GlobalObject::isRuntimeCodeGenEnabled(cx, scopeObjGlobal)) { JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL); return false; } // ES5 15.1.2.1 step 1. if (!v.isString()) { vp.set(v); return true; } RootedString str(cx, v.toString()); // ES5 15.1.2.1 steps 2-8. // Per ES5, indirect eval runs in the global scope. (eval is specified this // way so that the compiler can make assumptions about what bindings may or // may not exist in the current frame if it doesn't see 'eval'.) MOZ_ASSERT_IF(evalType != DIRECT_EVAL, cx->global() == &scopeobj->as<ClonedBlockObject>().global()); RootedLinearString linearStr(cx, str->ensureLinear(cx)); if (!linearStr) return false; RootedScript callerScript(cx, caller ? caller.script() : nullptr); EvalJSONResult ejr = TryEvalJSON(cx, linearStr, vp); if (ejr != EvalJSON_NotJSON) return ejr == EvalJSON_Success; EvalScriptGuard esg(cx); if (evalType == DIRECT_EVAL && caller.isFunctionFrame()) esg.lookupInEvalCache(linearStr, callerScript, pc); if (!esg.foundScript()) { RootedScript maybeScript(cx); unsigned lineno; const char* filename; bool mutedErrors; uint32_t pcOffset; DescribeScriptedCallerForCompilation(cx, &maybeScript, &filename, &lineno, &pcOffset, &mutedErrors, evalType == DIRECT_EVAL ? CALLED_FROM_JSOP_EVAL : NOT_CALLED_FROM_JSOP_EVAL); const char* introducerFilename = filename; if (maybeScript && maybeScript->scriptSource()->introducerFilename()) introducerFilename = maybeScript->scriptSource()->introducerFilename(); RootedObject enclosing(cx); if (evalType == DIRECT_EVAL) enclosing = callerScript->innermostStaticScope(pc); else enclosing = &cx->global()->lexicalScope().staticBlock(); Rooted<StaticEvalScope*> staticScope(cx, StaticEvalScope::create(cx, enclosing)); if (!staticScope) return false; CompileOptions options(cx); options.setIsRunOnce(true) .setForEval(true) .setNoScriptRval(false) .setMutedErrors(mutedErrors) .maybeMakeStrictMode(evalType == DIRECT_EVAL && IsStrictEvalPC(pc)); if (introducerFilename) { options.setFileAndLine(filename, 1); options.setIntroductionInfo(introducerFilename, "eval", lineno, maybeScript, pcOffset); } else { options.setFileAndLine("eval", 1); options.setIntroductionType("eval"); } AutoStableStringChars linearChars(cx); if (!linearChars.initTwoByte(cx, linearStr)) return false; const char16_t* chars = linearChars.twoByteRange().start().get(); SourceBufferHolder::Ownership ownership = linearChars.maybeGiveOwnershipToCaller() ? SourceBufferHolder::GiveOwnership : SourceBufferHolder::NoOwnership;//.........这里部分代码省略.........
开发者ID:emilio,项目名称:gecko-dev,代码行数:101,
示例21: EvalKernel// Common code implementing direct and indirect eval.//// Evaluate call.argv[2], if it is a string, in the context of the given calling// frame, with the provided scope chain, with the semantics of either a direct// or indirect eval (see ES5 10.4.2). If this is an indirect eval, scopeobj// must be a global object.//// On success, store the completion value in call.rval and return true.static boolEvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFramePtr caller, HandleObject scopeobj, jsbytecode *pc){ JS_ASSERT((evalType == INDIRECT_EVAL) == !caller); JS_ASSERT((evalType == INDIRECT_EVAL) == !pc); JS_ASSERT_IF(evalType == INDIRECT_EVAL, scopeobj->is<GlobalObject>()); AssertInnerizedScopeChain(cx, *scopeobj); Rooted<GlobalObject*> scopeObjGlobal(cx, &scopeobj->global()); if (!GlobalObject::isRuntimeCodeGenEnabled(cx, scopeObjGlobal)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_EVAL); return false; } // ES5 15.1.2.1 step 1. if (args.length() < 1) { args.rval().setUndefined(); return true; } if (!args[0].isString()) { args.rval().set(args[0]); return true; } RootedString str(cx, args[0].toString()); // ES5 15.1.2.1 steps 2-8. // Per ES5, indirect eval runs in the global scope. (eval is specified this // way so that the compiler can make assumptions about what bindings may or // may not exist in the current frame if it doesn't see 'eval'.) unsigned staticLevel; RootedValue thisv(cx); if (evalType == DIRECT_EVAL) { JS_ASSERT_IF(caller.isInterpreterFrame(), !caller.asInterpreterFrame()->runningInJit()); staticLevel = caller.script()->staticLevel() + 1; // Direct calls to eval are supposed to see the caller's |this|. If we // haven't wrapped that yet, do so now, before we make a copy of it for // the eval code to use. if (!ComputeThis(cx, caller)) return false; thisv = caller.thisValue(); } else { JS_ASSERT(args.callee().global() == *scopeobj); staticLevel = 0; // Use the global as 'this', modulo outerization. JSObject *thisobj = JSObject::thisObject(cx, scopeobj); if (!thisobj) return false; thisv = ObjectValue(*thisobj); } Rooted<JSFlatString*> flatStr(cx, str->ensureFlat(cx)); if (!flatStr) return false; RootedScript callerScript(cx, caller ? caller.script() : nullptr); EvalJSONResult ejr = TryEvalJSON(cx, callerScript, flatStr, args.rval()); if (ejr != EvalJSON_NotJSON) return ejr == EvalJSON_Success; EvalScriptGuard esg(cx); if (evalType == DIRECT_EVAL && caller.isNonEvalFunctionFrame()) esg.lookupInEvalCache(flatStr, callerScript, pc); if (!esg.foundScript()) { RootedScript maybeScript(cx); unsigned lineno; const char *filename; JSPrincipals *originPrincipals; uint32_t pcOffset; DescribeScriptedCallerForCompilation(cx, &maybeScript, &filename, &lineno, &pcOffset, &originPrincipals, evalType == DIRECT_EVAL ? CALLED_FROM_JSOP_EVAL : NOT_CALLED_FROM_JSOP_EVAL); const char *introducerFilename = filename; if (maybeScript && maybeScript->scriptSource()->introducerFilename()) introducerFilename = maybeScript->scriptSource()->introducerFilename(); CompileOptions options(cx); options.setFileAndLine(filename, 1) .setCompileAndGo(true) .setForEval(true) .setNoScriptRval(false) .setOriginPrincipals(originPrincipals) .setIntroductionInfo(introducerFilename, "eval", lineno, maybeScript, pcOffset);//.........这里部分代码省略.........
开发者ID:martasect,项目名称:gecko,代码行数:101,
注:本文中的AbstractFramePtr类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AbstractKart类代码示例 C++ AbstractFile类代码示例 |